You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Brian Minchau (JIRA)" <xa...@xml.apache.org> on 2006/11/01 01:08:21 UTC

[jira] Resolved: (XALANJ-1171) TCK: Error should be reported to System.err if there is no registered ErrorListener

     [ http://issues.apache.org/jira/browse/XALANJ-1171?page=all ]

Brian Minchau resolved XALANJ-1171.
-----------------------------------

    Fix Version/s: 2.7
                       (was: Latest Development Code)
       Resolution: Fixed

> 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
>          Issue Type: Bug
>          Components: transformation, Xalan-interpretive
>    Affects Versions: Latest Development Code
>         Environment: Operating System: All
> Platform: All
>            Reporter: Morris Kwan
>             Fix For: 2.7
>
>
> 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: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org