@Test public void testUnpackThrowsNullPointerException2() throws Throwable { CTCSubElementPackager cTCSubElementPackager = new CTCSubElementPackager(); ISOFieldPackager[] fld = new ISOFieldPackager[2]; fld[0] = new IFA_AMOUNT(); cTCSubElementPackager.setFieldPackager(fld); byte[] b = new byte[3]; ISOComponent m = new ISOMsg("testCTCSubElementPackagerMti"); try { cTCSubElementPackager.unpack(m, b); fail("Expected NullPointerException to be thrown"); } catch (NullPointerException ex) { if (isJavaVersionAtMost(JAVA_14)) { assertNull(ex.getMessage(), "ex.getMessage()"); } else { assertEquals("Cannot invoke \"org.jpos.iso.ISOFieldPackager.createComponent(int)\" because \"this.fld[i]\" is null", ex.getMessage(), "ex.getMessage()"); } } }
public int unpack ( ISOComponent m, byte[] b ) throws ISOException { LogEvent evt = new LogEvent ( this, "unpack" ); int consumed = 0; for ( int i=0; consumed < b.length ; i++ ) { ISOComponent c = fld[i].createComponent( i ); consumed += fld[i].unpack ( c, b, consumed ); if ( logger != null ) { evt.addMessage ("<unpack fld=\"" + i +"\" packager=\"" +fld[i].getClass().getName()+ "\">"); if (c.getValue() instanceof ISOMsg) evt.addMessage (c.getValue()); else evt.addMessage (" <value>" +c.getValue().toString() + "</value>"); evt.addMessage ("</unpack>"); } m.set(c); } Logger.log (evt); return consumed; }
CTCSubElementPackager extends ISOBaseValidatingPackager { public int unpack ( ISOComponent m, byte[] b ) throws ISOException { LogEvent evt = new LogEvent ( this, "unpack" ); int consumed = 0; for ( int i=0; consumed < b.length ; i++ ) { ISOComponent c = fld[i].createComponent( i ); consumed += fld[i].unpack ( c, b, consumed ); if ( logger != null ) { evt.addMessage ("<unpack fld=\"" + i +"\" packager=\"" +fld[i].getClass().getName()+ "\">"); if (c.getValue() instanceof ISOMsg) evt.addMessage (c.getValue()); else evt.addMessage (" <value>" +c.getValue().toString() + "</value>"); evt.addMessage ("</unpack>"); } m.set(c); } Logger.log (evt); return consumed; } }
CTCSubElementPackager extends ISOBaseValidatingPackager { public int unpack ( ISOComponent m, byte[] b ) throws ISOException { LogEvent evt = new LogEvent ( this, "unpack" ); int consumed = 0; for ( int i=0; consumed < b.length ; i++ ) { ISOComponent c = fld[i].createComponent( i ); consumed += fld[i].unpack ( c, b, consumed ); if ( logger != null ) { evt.addMessage ("<unpack fld=\"" + i +"\" packager=\"" +fld[i].getClass().getName()+ "\">"); if (c.getValue() instanceof ISOMsg) evt.addMessage (c.getValue()); else evt.addMessage (" <value>" +c.getValue().toString() + "</value>"); evt.addMessage ("</unpack>"); } m.set(c); } Logger.log (evt); return consumed; } CTCSubElementPackager(); }
CTCSubElementPackager extends ISOBaseValidatingPackager { public int unpack ( ISOComponent m, byte[] b ) throws ISOException { LogEvent evt = new LogEvent ( this, "unpack" ); int consumed = 0; for ( int i=0; consumed < b.length ; i++ ) { ISOComponent c = fld[i].createComponent( i ); consumed += fld[i].unpack ( c, b, consumed ); if ( logger != null ) { evt.addMessage ("<unpack fld=\"" + i +"\" packager=\"" +fld[i].getClass().getName()+ "\">"); if (c.getValue() instanceof ISOMsg) evt.addMessage (c.getValue()); else evt.addMessage (" <value>" +c.getValue().toString() + "</value>"); evt.addMessage ("</unpack>"); } m.set(c); } Logger.log (evt); return consumed; } CTCSubElementPackager(); byte[] pack( ISOComponent c ); int unpack( ISOComponent m, byte[] b ); ISOComponent validate( ISOComponent c ); }
CTCSubElementPackager extends ISOBaseValidatingPackager { public int unpack ( ISOComponent m, byte[] b ) throws ISOException { LogEvent evt = new LogEvent ( this, "unpack" ); int consumed = 0; for ( int i=0; consumed < b.length ; i++ ) { ISOComponent c = fld[i].createComponent( i ); consumed += fld[i].unpack ( c, b, consumed ); if ( logger != null ) { evt.addMessage ("<unpack fld=\"" + i +"\" packager=\"" +fld[i].getClass().getName()+ "\">"); if (c.getValue() instanceof ISOMsg) evt.addMessage (c.getValue()); else evt.addMessage (" <value>" +c.getValue().toString() + "</value>"); evt.addMessage ("</unpack>"); } m.set(c); } Logger.log (evt); return consumed; } CTCSubElementPackager(); byte[] pack( ISOComponent c ); int unpack( ISOComponent m, byte[] b ); ISOComponent validate( ISOComponent c );  }