[ http://issues.apache.org/jira/browse/XALANJ-1462?page=all ]
Brian Minchau updated XALANJ-1462: ---------------------------------- Version: Latest Development Code (was: 2.3) > Using an InputStream with "getAssociatedStylesheet()" causes IOException > ------------------------------------------------------------------------ > > Key: XALANJ-1462 > URL: http://issues.apache.org/jira/browse/XALANJ-1462 > Project: XalanJ2 > Type: Bug > Components: transformation, Xalan-interpretive > Versions: Latest Development Code > Environment: Operating System: All > Platform: PC > Reporter: Gerard Fernandes > Assignee: Xalan Developers Mailing List > > Using an InputStream as the Source XML along with "getAssociatedStylesheet()" > causes the transformation to fail with an IOException due to Stream closed. > This probably happens because the "getAssociatedStylesheet()" method causes > the > stream to be closed at the end. This happens because the Xerces SAX Parser > Implementation seems to be closing the InputStream passed to it for parsing > (which may be good in some cases, but can cause problems when used in the > following manner). > The subsequent call to "transform(source, result)" therefore acts on a closed > source stream and throws the IOException. > Sample code: > ------------ > public void transform(InputStream source, OutputStream result) > { > Source style = TransformerFactory.newInstance().getAssociatedStylesheet( > source, null, null, null); > Transformer t = TransformerFactory.newInstance().newTransformer(); > if(style != null){ > t = TransformerFactory.newInstance().newTransformer(style); > } > t.transform(new StreamSource(source), new StreamResult(result)); > } > Exception: > ---------- > java.io.IOException: The system cannot find the path specified > at java.io.FileInputStream.read(Native Method) > at > org.apache.xerces.impl.XMLEntityManager$RewindableInputStream.read(XMLEntityManager.java:3278) > at > org.apache.xerces.impl.XMLEntityManager.startEntity(XMLEntityManager.java:742) > at > org.apache.xerces.impl.XMLEntityManager.startDocumentEntity(XMLEntityManager.java:676) > at > org.apache.xerces.impl.XMLDocumentScannerImpl.setInputSource(XMLDocumentScannerImpl.java:252) > at > org.apache.xerces.parsers.StandardParserConfiguration.parse(StandardParserConfiguration.java:499) > at > org.apache.xerces.parsers.StandardParserConfiguration.parse(StandardParserConfiguration.java:581) > at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:147) > at > org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1157) > at > org.apache.xml.dtm.ref.DTMManagerDefault.getDTM(DTMManagerDefault.java:449) > at > org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:625) > at > org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1088) > at > org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1066) > at com.vigorsoft.xsl.XSLTHelper.transform(XSLTHelper.java:93) > at com.vigorsoft.xsl.XSLTHelper.transform(XSLTHelper.java:77) > at com.vigorsoft.xsl.XSLTHelper.main(XSLTHelper.java:104) -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]