-
Bug
-
Resolution: Fixed
-
P4
-
1.1.3, 1.2.0, 1.3.0, 1.4.1, 5.0
-
1.3
-
generic
-
generic
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2096581 | 5.0 | Arun Yadav | P4 | Resolved | Fixed | b55 |
Name: eaR10174 Date: 10/05/2001
Errors are not reported to System.err when the xsl source with non-fatal errors is processed into a
Transformer object (see test.java below) and the application does not register an ErrorListener. The
TransformerConfigurationException is thrown instead of the report. The javadoc description of the
javax.xml.transform.ErrorListener (jdk1.4.0beta-b82) reads:
"public interface ErrorListener
...
If an application does not register an ErrorListener, errors are reported to System.err."
This bug is found in the build jdk1.4.0-beta3-b82 and affects a new JCK1.4 test
api/javax_xml/transform/ErrorListener/index.html#Error[Error002]
In test.java the xsl source has the error: element 'xsl:template' contains the attribute 'a'. This is
non-fatal error, the attribute can be ignored.
------------------------------------test.java-----------------------------
import javax.xml.transform.stream.StreamSource;
import java.io.StringReader;
import javax.xml.transform.TransformerFactory;
import java.io.PrintStream;
import java.io.ByteArrayOutputStream;
public class test {
private static String XSL1 = "<xsl:stylesheet version='1.0' "
+ "xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>"
+ "<xsl:template a='1' match='/'>"
+ "<H2><xsl:value-of select='//author'/></h2>"
+ "<H1><xsl:value-of select='//title'/></h1>"
+ "</xsl:template>"
+ "</xsl:stylesheet>";
public static void main (String[] args) {
try {
/* Create a TransformFactory instance */
TransformerFactory transformerFactory = TransformerFactory.newInstance();
/* Create and init a StreamSource instance */
StreamSource source = new StreamSource(new StringReader(XSL1));
/* Create the "standard" error output stream replacement */
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
PrintStream err = new PrintStream(byteArrayOutputStream);
/* Set the new created error output stream */
System.setErr(err);
transformerFactory.newTransformer(source);
if (byteArrayOutputStream.toString().length() != 0) {
System.out.println("OK");
} else {
System.out.println("No data written to System.err");
}
} catch (Exception e) {
System.out.println(e);
}
}
}
---------------------------------------------------------------------------
---------------------------------------------------------------------------
% java -showversion test
java version "1.4.0-beta3"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta3-b82)
Java HotSpot(TM) Client VM (build 1.4.0-beta3-b82, mixed mode)
javax.xml.transform.TransformerConfigurationException:
javax.xml.transform.TransformerConfigurationException: javax.xml.transform.TransformerException:
javax.xml.transform.TransformerException: "a" attribute is not allowed on the xsl:template element!
---------------------------------------------------------------------------
======================================================================
###@###.### 2003-08-13
Errors are not reported to System.err when the xsl source with non-fatal errors is processed into a
Transformer object (see test.java below) and the application does not register an ErrorListener. The
TransformerConfigurationException is thrown instead of the report. The javadoc description of the
javax.xml.transform.ErrorListener (jdk1.4.0beta-b82) reads:
"public interface ErrorListener
...
If an application does not register an ErrorListener, errors are reported to System.err."
This bug is found in the build jdk1.4.0-beta3-b82 and affects a new JCK1.4 test
api/javax_xml/transform/ErrorListener/index.html#Error[Error002]
In test.java the xsl source has the error: element 'xsl:template' contains the attribute 'a'. This is
non-fatal error, the attribute can be ignored.
------------------------------------test.java-----------------------------
import javax.xml.transform.stream.StreamSource;
import java.io.StringReader;
import javax.xml.transform.TransformerFactory;
import java.io.PrintStream;
import java.io.ByteArrayOutputStream;
public class test {
private static String XSL1 = "<xsl:stylesheet version='1.0' "
+ "xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>"
+ "<xsl:template a='1' match='/'>"
+ "<H2><xsl:value-of select='//author'/></h2>"
+ "<H1><xsl:value-of select='//title'/></h1>"
+ "</xsl:template>"
+ "</xsl:stylesheet>";
public static void main (String[] args) {
try {
/* Create a TransformFactory instance */
TransformerFactory transformerFactory = TransformerFactory.newInstance();
/* Create and init a StreamSource instance */
StreamSource source = new StreamSource(new StringReader(XSL1));
/* Create the "standard" error output stream replacement */
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
PrintStream err = new PrintStream(byteArrayOutputStream);
/* Set the new created error output stream */
System.setErr(err);
transformerFactory.newTransformer(source);
if (byteArrayOutputStream.toString().length() != 0) {
System.out.println("OK");
} else {
System.out.println("No data written to System.err");
}
} catch (Exception e) {
System.out.println(e);
}
}
}
---------------------------------------------------------------------------
---------------------------------------------------------------------------
% java -showversion test
java version "1.4.0-beta3"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta3-b82)
Java HotSpot(TM) Client VM (build 1.4.0-beta3-b82, mixed mode)
javax.xml.transform.TransformerConfigurationException:
javax.xml.transform.TransformerConfigurationException: javax.xml.transform.TransformerException:
javax.xml.transform.TransformerException: "a" attribute is not allowed on the xsl:template element!
---------------------------------------------------------------------------
======================================================================
###@###.### 2003-08-13
- backported by
-
JDK-2096581 A TransformerConfigurationException is thrown instead of the report about error
- Resolved
-
JDK-2096582 A TransformerConfigurationException is thrown instead of the report about error
- Closed