DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13257>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13257 ClassCastException when calling SAXTransformerFactory.newTransformerHandler() with an identity Templates object Summary: ClassCastException when calling SAXTransformerFactory.newTransformerHandler() with an identity Templates object Product: XalanJ2 Version: CurrentCVS Platform: All OS/Version: All Status: NEW Severity: Normal Priority: Other Component: org.apache.xalan.processor AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] java.lang.ClassCastException at org.apache.xalan.processor.TransformerFactoryImpl.newTransformerHandler(TransformerFactoryImpl.java:670) This occurs when this code sample is used: TransformerFactory factory = TransformerFactory.newInstance(); final Transformer transformer = factory.newTransformer(); Templates templates = new Templates() { public Transformer newTransformer() throws TransformerConfigurationException { return transformer; } public Properties getOutputProperties() { return transformer.getOutputProperties(); } }; SAXTransformerFactory saxFactory = (SAXTransformerFactory)factory; TransformerHandler handler = saxFactory.newTransformerHandler(templates); This occurs because the identity Transformer from factory.newTransformer() is an instance of TransformerIdentityImpl but not of TransformerImpl. The offending line in TransformerFactoryImpl.java is: TransformerImpl transformer = (TransformerImpl) templates.newTransformer(); There's no reason why I shouldn't be able to use an identity transform on a TransformerHandler. Thank you, --Jase
