-
Bug
-
Resolution: Fixed
-
P3
-
5.0
-
1.3
-
generic
-
generic
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2078432 | 5.0 | Kohsuke Kawaguchi | P3 | Closed | Fixed | b32 |
Name: eaR10174 Date: 12/17/2003
The methods
javax.xml.validation.Validator.getFeature()
javax.xml.validation.Validator.setFeature()
throw SAXNotRecognizedException instead of NullPointerException in case when a feature name is
null. The methods should throw NullPointerException according to the javadoc.
The bug affects new JCK1.5 tests (not integrated yet):
api/javax_xml/validation/Validator/index.html#GetSetFeature[GetSetFeature001]
api/javax_xml/validation/Validator/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.Validator;
public class test {
SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
public static void main(String argv[]) {
test t = new test();
t.run01();
System.out.println("\n");
t.run02();
}
public void run01() {
try {
Validator validator = schemaFactory.newSchema().newValidator();
System.out.println("Validator.getFeature(null)");
validator.getFeature(null);
} catch (Exception e) {
if (e instanceof NullPointerException) {
System.out.println("OK");
} else {
System.out.print("Failed. ");
e.printStackTrace();
}
}
}
public void run02() {
try {
Validator validator = schemaFactory.newSchema().newValidator();
System.out.println("Validator.setFeature(null, false)");
validator.setFeature(null, false);
} catch (Exception e) {
if (e instanceof NullPointerException) {
System.out.println("OK");
} else {
System.out.print("Failed. ");
e.printStackTrace();
}
}
}
}
--------------------------------------------------------------------------
% java -showversion test
java version "1.5.0-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b31)
Java HotSpot(TM) Client VM (build 1.5.0-beta-b31, mixed mode)
Validator.getFeature(null)
Failed. org.xml.sax.SAXNotRecognizedException
at javax.xml.validation.Validator.getFeature(Validator.java:306)
at test.run01(test.java:19)
at test.main(test.java:9)
Validator.setFeature(null, false)
Failed. org.xml.sax.SAXNotRecognizedException
at javax.xml.validation.Validator.setFeature(Validator.java:338)
at test.run02(test.java:34)
at test.main(test.java:12)
--------------------------------------------------------------------------
======================================================================
The methods
javax.xml.validation.Validator.getFeature()
javax.xml.validation.Validator.setFeature()
throw SAXNotRecognizedException instead of NullPointerException in case when a feature name is
null. The methods should throw NullPointerException according to the javadoc.
The bug affects new JCK1.5 tests (not integrated yet):
api/javax_xml/validation/Validator/index.html#GetSetFeature[GetSetFeature001]
api/javax_xml/validation/Validator/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.Validator;
public class test {
SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
public static void main(String argv[]) {
test t = new test();
t.run01();
System.out.println("\n");
t.run02();
}
public void run01() {
try {
Validator validator = schemaFactory.newSchema().newValidator();
System.out.println("Validator.getFeature(null)");
validator.getFeature(null);
} catch (Exception e) {
if (e instanceof NullPointerException) {
System.out.println("OK");
} else {
System.out.print("Failed. ");
e.printStackTrace();
}
}
}
public void run02() {
try {
Validator validator = schemaFactory.newSchema().newValidator();
System.out.println("Validator.setFeature(null, false)");
validator.setFeature(null, false);
} catch (Exception e) {
if (e instanceof NullPointerException) {
System.out.println("OK");
} else {
System.out.print("Failed. ");
e.printStackTrace();
}
}
}
}
--------------------------------------------------------------------------
% java -showversion test
java version "1.5.0-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b31)
Java HotSpot(TM) Client VM (build 1.5.0-beta-b31, mixed mode)
Validator.getFeature(null)
Failed. org.xml.sax.SAXNotRecognizedException
at javax.xml.validation.Validator.getFeature(Validator.java:306)
at test.run01(test.java:19)
at test.main(test.java:9)
Validator.setFeature(null, false)
Failed. org.xml.sax.SAXNotRecognizedException
at javax.xml.validation.Validator.setFeature(Validator.java:338)
at test.run02(test.java:34)
at test.main(test.java:12)
--------------------------------------------------------------------------
======================================================================
- backported by
-
JDK-2078432 Validator.set/getFeature() throws SAXNotRecognizedException instead of NPE
- Closed