You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by bu...@apache.org on 2002/09/06 21:10:25 UTC
DO NOT REPLY [Bug 12376] New: -
TCK: Error should be reported to System.err if there is no registered ErrorListener
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=12376>.
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=12376
TCK: Error should be reported to System.err if there is no registered ErrorListener
Summary: TCK: Error should be reported to System.err if there is
no registered ErrorListener
Product: XalanJ2
Version: CurrentCVS
Platform: All
OS/Version: All
Status: NEW
Severity: Normal
Priority: Other
Component: org.apache.xalan.transformer
AssignedTo: xalan-dev@xml.apache.org
ReportedBy: mkwan@ca.ibm.com
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.