You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by xa...@xml.apache.org on 2004/09/24 17:30:10 UTC

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

The following issue has been updated:

    Updater: Brian Minchau (mailto:minchau@ca.ibm.com)
       Date: Fri, 24 Sep 2004 8:28 AM
    Changes:
             Component changed to transformation
    ---------------------------------------------------------------------
For a full history of the issue, see:

  http://issues.apache.org/jira/browse/XALANJ-1171?page=history

---------------------------------------------------------------------
View the issue:
  http://issues.apache.org/jira/browse/XALANJ-1171

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: XALANJ-1171
    Summary: TCK: Error should be reported to System.err if there is no registered ErrorListener
       Type: Bug

     Status: Open

    Project: XalanJ2
 Components: 
             Xalan-interpretive transformation
             transformation
   Versions:
             CurrentCVS

   Assignee: Xalan Developers Mailing List
   Reporter: Morris Kwan

    Created: Fri, 6 Sep 2002 7:10 PM
    Updated: Fri, 24 Sep 2004 8:28 AM
Environment: Operating System: All
Platform: All

Description:
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.


---------------------------------------------------------------------
JIRA INFORMATION:
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

If you want more information on JIRA, or have a bug to report 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