@Test public void testReadFileThrowsISOException() throws Throwable { try { new GenericSubFieldPackager().readFile(new ByteArrayInputStream("".getBytes())); fail("Expected ISOException to be thrown"); } catch (ISOException ex) { assertEquals(SAXParseException.class, ex.getNested().getClass(), "ex.getNested().getClass()"); assertEquals("Premature end of file.", ex.getNested().getMessage(), "ex.getNested().getMessage()"); } }
public void readFile(String filename) throws ISOException { try { if (filename.startsWith("jar:") && filename.length()>4) { ClassLoader cl = Thread.currentThread().getContextClassLoader(); readFile( cl.getResourceAsStream(filename.substring(4)) ); } else { createXMLReader().parse(filename); } } catch (Exception e) { throw new ISOException("Error reading " + filename, e); } }
GenericPackager extends ISOBasePackager implements Configurable { public void readFile(String filename) throws ISOException { try { if (filename.startsWith("jar:") && filename.length()>4) { ClassLoader cl = Thread.currentThread().getContextClassLoader(); readFile( cl.getResourceAsStream(filename.substring(4)) ); } else { createXMLReader().parse(filename); } } catch (Exception e) { throw new ISOException("Error reading " + filename, e); } } }
GenericPackager extends ISOBasePackager implements Configurable { public void readFile(String filename) throws ISOException { try { if (filename.startsWith("jar:") && filename.length()>4) { ClassLoader cl = Thread.currentThread().getContextClassLoader(); readFile( cl.getResourceAsStream(filename.substring(4)) ); } else { createXMLReader().parse(filename); } } catch (Exception e) { throw new ISOException("Error reading " + filename, e); } } GenericPackager();  GenericPackager(String filename);  GenericPackager(InputStream input); }
GenericPackager extends ISOBasePackager implements Configurable { public void readFile(String filename) throws ISOException { try { if (filename.startsWith("jar:") && filename.length()>4) { ClassLoader cl = Thread.currentThread().getContextClassLoader(); readFile( cl.getResourceAsStream(filename.substring(4)) ); } else { createXMLReader().parse(filename); } } catch (Exception e) { throw new ISOException("Error reading " + filename, e); } } GenericPackager();  GenericPackager(String filename);  GenericPackager(InputStream input); void setConfiguration(Configuration cfg); void readFile(String filename); void readFile(InputStream input); @Override void setLogger(Logger logger, String realm); @Override String getDescription(); }
GenericPackager extends ISOBasePackager implements Configurable { public void readFile(String filename) throws ISOException { try { if (filename.startsWith("jar:") && filename.length()>4) { ClassLoader cl = Thread.currentThread().getContextClassLoader(); readFile( cl.getResourceAsStream(filename.substring(4)) ); } else { createXMLReader().parse(filename); } } catch (Exception e) { throw new ISOException("Error reading " + filename, e); } } GenericPackager();  GenericPackager(String filename);  GenericPackager(InputStream input); void setConfiguration(Configuration cfg); void readFile(String filename); void readFile(InputStream input); @Override void setLogger(Logger logger, String realm); @Override String getDescription();  }