public void start(ContentHandler sax, Target target) throws IOException, SAXException { this.target = target; XMLReader parser; try { parser = spf.newSAXParser().getXMLReader(); } catch (ParserConfigurationException e) { throw new LagoonException(e.getMessage()); } parser.setContentHandler(sax); parser.setEntityResolver( new EntityResolver() { public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException { InputSource is = new InputSource(getSourceMan().getFileURL(systemId)); File fil = getSourceMan().getFile(systemId); if (fil != null) { InputStream istr = new FileInputStream(fil); is.setByteStream(istr); } return is; } }); exception = null; mis = new MyInputStream(); mos = new MyOutputStream(mis); thread = new Thread(this); thread.start(); parser.parse(new InputSource(mis)); mis.close(); try { thread.join(1000); } catch (InterruptedException e) { } if (thread.isAlive()) { thread.interrupt(); } this.target = null; if (exception != null) { if (exception instanceof SAXException) { throw (SAXException) exception; } else if (exception instanceof IOException) { throw (IOException) exception; } } }
/* * 3 covered goals: * 1 nu.staldal.lagoon.producer.MyInputStream.deliver(I)V: I4 Branch 7 IFEQ L241 - false * 2 nu.staldal.lagoon.producer.MyInputStream.eof()V: root-Branch * 3 nu.staldal.lagoon.producer.MyInputStream.<init>()V: root-Branch */ @Test public void test2() throws Throwable { MyInputStream myInputStream0 = new MyInputStream(); myInputStream0.eof(); myInputStream0.deliver((-1)); }
/* * 3 covered goals: * 1 nu.staldal.lagoon.producer.MyInputStream.deliver(I)V: I4 Branch 7 IFEQ L241 - true * 2 nu.staldal.lagoon.producer.MyInputStream.deliver(I)V: I10 Branch 8 IFEQ L242 - true * 3 nu.staldal.lagoon.producer.MyInputStream.deliver(I)V: I21 Branch 9 IF_ICMPEQ L244 - true */ @Test public void test1() throws Throwable { MyInputStream myInputStream0 = new MyInputStream(); myInputStream0.deliver((-268)); }
/* * 2 covered goals: * 1 nu.staldal.lagoon.producer.MyInputStream.close()V: root-Branch * 2 nu.staldal.lagoon.producer.MyInputStream.<init>()V: root-Branch */ @Test public void test0() throws Throwable { MyInputStream myInputStream0 = new MyInputStream(); myInputStream0.close(); }
public void close() { if (eof) return; // flush(); eof = true; sink.eof(); }
public void write(int b) throws IOException { if (eof) throw new IOException("Attempt to write to closed stream"); sink.deliver(b); }