-
Bug
-
Resolution: Fixed
-
P3
-
5.0
-
b36
-
generic
-
generic
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2078495 | 1.3.0 | Kohsuke Kawaguchi | P3 | Closed | Fixed | 1.3 |
Name: eaR10174 Date: 12/18/2003
The method
javax.xml.validation.ValidatorHandler.setFeature()
throws SAXNotRecognizedException instead of NullPointerException in case when a feature name is
null. The method should throw NullPointerException according to the javadoc.
The bug affects a new JCK1.5 test (not integrated yet):
api/javax_xml/validation/ValidatorHandler/index.html#GetSetFeature[GetSetFeature003]
The following test fails running on JDK 1.5.0-beta-b31.
See below the test source and the execution log:
------------------------------------test.java-----------------------------
import javax.xml.validation.SchemaFactory;
import javax.xml.validation.ValidatorHandler;
public class test {
SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
public static void main(String argv[]) {
test t = new test();
t.run();
}
public void run() {
try {
ValidatorHandler validatorHandler =
schemaFactory.newSchema().newValidatorHandler();
validatorHandler.setFeature(null, false);
} catch (Exception e) {
if (e instanceof NullPointerException) {
System.out.println("OK");
} else {
System.out.print("Failed. ");
e.printStackTrace();
}
}
}
}
--------------------------------------------------------------------------
% java -showversion test
Failed. org.xml.sax.SAXNotRecognizedException
at javax.xml.validation.ValidatorHandler.setFeature(ValidatorHandler.java:380)
at test.run(test.java:15)
at test.main(test.java:9)
--------------------------------------------------------------------------
======================================================================
The method
javax.xml.validation.ValidatorHandler.setFeature()
throws SAXNotRecognizedException instead of NullPointerException in case when a feature name is
null. The method should throw NullPointerException according to the javadoc.
The bug affects a new JCK1.5 test (not integrated yet):
api/javax_xml/validation/ValidatorHandler/index.html#GetSetFeature[GetSetFeature003]
The following test fails running on JDK 1.5.0-beta-b31.
See below the test source and the execution log:
------------------------------------test.java-----------------------------
import javax.xml.validation.SchemaFactory;
import javax.xml.validation.ValidatorHandler;
public class test {
SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
public static void main(String argv[]) {
test t = new test();
t.run();
}
public void run() {
try {
ValidatorHandler validatorHandler =
schemaFactory.newSchema().newValidatorHandler();
validatorHandler.setFeature(null, false);
} catch (Exception e) {
if (e instanceof NullPointerException) {
System.out.println("OK");
} else {
System.out.print("Failed. ");
e.printStackTrace();
}
}
}
}
--------------------------------------------------------------------------
% java -showversion test
Failed. org.xml.sax.SAXNotRecognizedException
at javax.xml.validation.ValidatorHandler.setFeature(ValidatorHandler.java:380)
at test.run(test.java:15)
at test.main(test.java:9)
--------------------------------------------------------------------------
======================================================================
- backported by
-
JDK-2078495 ValidationHandler.setFeature() throws SAXNotRecognizedException instead of NPE
- Closed
- relates to
-
JDK-4971607 ValidatorHandler.getFeature() throws SAXNotRecognizedException instead of NPE
- Closed