@Test public void testCharactersThrowsEmptyStackException() throws Throwable { char[] ch = new char[0]; try { new XMLPackager().characters(ch, 100, 1000); fail("Expected EmptyStackException to be thrown"); } catch (EmptyStackException ex) { assertNull(ex.getMessage(), "ex.getMessage()"); } }
public void characters (char ch[], int start, int length) { Object obj = stk.peek(); if (obj instanceof ISOField) { ISOField f = (ISOField) obj; String value = f.getValue() + new String(ch, start, length); try { f.setValue(value); } catch (ISOException e) { try { f.setValue (e.getMessage()); } catch (ISOException ignored) { } } } else if (obj instanceof BaseHeader) { BaseHeader bh = (BaseHeader) obj; String s = new String(ch,start,length); if (bh.isAsciiEncoding()) { bh.unpack (s.getBytes()); } else { bh.unpack (ISOUtil.hex2byte (s)); } } }
XMLPackager extends DefaultHandler implements ISOPackager, LogSource { public void characters (char ch[], int start, int length) { Object obj = stk.peek(); if (obj instanceof ISOField) { ISOField f = (ISOField) obj; String value = f.getValue() + new String(ch, start, length); try { f.setValue(value); } catch (ISOException e) { try { f.setValue (e.getMessage()); } catch (ISOException ignored) { } } } else if (obj instanceof BaseHeader) { BaseHeader bh = (BaseHeader) obj; String s = new String(ch,start,length); if (bh.isAsciiEncoding()) { bh.unpack (s.getBytes()); } else { bh.unpack (ISOUtil.hex2byte (s)); } } } }
XMLPackager extends DefaultHandler implements ISOPackager, LogSource { public void characters (char ch[], int start, int length) { Object obj = stk.peek(); if (obj instanceof ISOField) { ISOField f = (ISOField) obj; String value = f.getValue() + new String(ch, start, length); try { f.setValue(value); } catch (ISOException e) { try { f.setValue (e.getMessage()); } catch (ISOException ignored) { } } } else if (obj instanceof BaseHeader) { BaseHeader bh = (BaseHeader) obj; String s = new String(ch,start,length); if (bh.isAsciiEncoding()) { bh.unpack (s.getBytes()); } else { bh.unpack (ISOUtil.hex2byte (s)); } } } XMLPackager(); }
XMLPackager extends DefaultHandler implements ISOPackager, LogSource { public void characters (char ch[], int start, int length) { Object obj = stk.peek(); if (obj instanceof ISOField) { ISOField f = (ISOField) obj; String value = f.getValue() + new String(ch, start, length); try { f.setValue(value); } catch (ISOException e) { try { f.setValue (e.getMessage()); } catch (ISOException ignored) { } } } else if (obj instanceof BaseHeader) { BaseHeader bh = (BaseHeader) obj; String s = new String(ch,start,length); if (bh.isAsciiEncoding()) { bh.unpack (s.getBytes()); } else { bh.unpack (ISOUtil.hex2byte (s)); } } } XMLPackager(); void forceBinary(int ... bfields); byte[] pack(ISOComponent c); synchronized int unpack(ISOComponent c, byte[] b); synchronized void unpack(ISOComponent c, InputStream in); void startElement(String ns, String name, String qName, Attributes atts); void characters(char ch[], int start, int length); void endElement(String ns, String name, String qname); String getFieldDescription(ISOComponent m, int fldNumber); void setLogger(Logger logger, String realm); String getRealm(); Logger getLogger(); ISOMsg createISOMsg(); String getDescription(); void setXMLParserFeature(String fname, boolean val); }
XMLPackager extends DefaultHandler implements ISOPackager, LogSource { public void characters (char ch[], int start, int length) { Object obj = stk.peek(); if (obj instanceof ISOField) { ISOField f = (ISOField) obj; String value = f.getValue() + new String(ch, start, length); try { f.setValue(value); } catch (ISOException e) { try { f.setValue (e.getMessage()); } catch (ISOException ignored) { } } } else if (obj instanceof BaseHeader) { BaseHeader bh = (BaseHeader) obj; String s = new String(ch,start,length); if (bh.isAsciiEncoding()) { bh.unpack (s.getBytes()); } else { bh.unpack (ISOUtil.hex2byte (s)); } } } XMLPackager(); void forceBinary(int ... bfields); byte[] pack(ISOComponent c); synchronized int unpack(ISOComponent c, byte[] b); synchronized void unpack(ISOComponent c, InputStream in); void startElement(String ns, String name, String qName, Attributes atts); void characters(char ch[], int start, int length); void endElement(String ns, String name, String qname); String getFieldDescription(ISOComponent m, int fldNumber); void setLogger(Logger logger, String realm); String getRealm(); Logger getLogger(); ISOMsg createISOMsg(); String getDescription(); void setXMLParserFeature(String fname, boolean val); static final String ISOMSG_TAG; static final String ISOFIELD_TAG; static final String ID_ATTR; static final String VALUE_ATTR; static final String TYPE_ATTR; static final String TYPE_BINARY; static final String TYPE_BITMAP; static final String TYPE_AMOUNT; static final String CURRENCY_ATTR; static final String HEADER_TAG; static final String ENCODING_ATTR; static final String ASCII_ENCODING; }