[ http://issues.apache.org/jira/browse/XALANJ-1171?page=all ] Morris Kwan closed XALANJ-1171: -------------------------------
> TCK: Error should be reported to System.err if there is no registered > ErrorListener > ----------------------------------------------------------------------------------- > > Key: XALANJ-1171 > URL: http://issues.apache.org/jira/browse/XALANJ-1171 > Project: XalanJ2 > Type: Bug > Components: transformation, Xalan-interpretive > Versions: Latest Development Code > Environment: Operating System: All > Platform: All > Reporter: Morris Kwan > Fix For: Latest Development Code > > The Javadoc for ErrorListener says: > For transformation errors, a Transformer must use this interface instead of > throwing an exception: it is up to the application to decide whether to throw > an exception for different types of errors and warnings. > If an application does not register an ErrorListener, errors are reported to > System.err. > Code to demonstrate the problem: > import javax.xml.transform.*; > import javax.xml.transform.stream.*; > import java.io.*; > public class ErrorListenerTest2 > { > // xsl:template has an invalid attribute (a='1'). > private static String XSL1 = "<xsl:stylesheet version='1.0' > xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>" > + "<xsl:template a='1' match='/'>" > + "<H1><xsl:value-of select='//title'/></H1>" > + "</xsl:template>" > + "</xsl:stylesheet>"; > > public static void main(String[] args) > { > StreamSource source = new StreamSource(new StringReader(XSL1)); > > try { > Transformer transformer = TransformerFactory.newInstance > ().newTransformer(source); > } > catch (TransformerException e) { > System.out.println("Error: TransformerException is thrown"); > System.out.println(e); > } > } > } > Current output: > Error: TransformerException is thrown > javax.xml.transform.TransformerConfigurationException: > javax.xml.transform.Trans > formerConfigurationException: javax.xml.transform.TransformerException: > javax.xm > l.transform.TransformerException: "a" attribute is not allowed on the > xsl:templa > te element! > The expected behavior is that there is no TransformerException thrown, and > the > error is reported to System.err. You should not see the line "Error: > TransformerException is thrown". Only the error message is displayed. -- 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]
