-
Bug
-
Resolution: Fixed
-
P3
-
1.3.0, 5.0
-
b36
-
generic
-
generic
-
Verified
Name: eaR10174 Date: 12/22/2003
The methods
javax.xml.validation.ValidatorHandler.getProperty()
javax.xml.validation.ValidatorHandler.setProperty()
throw SAXNotRecognizedException instead of NullPointerException in case when a property 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/ValidatorHandler/index.html#GetSetProperty[GetSetProperty001]
api/javax_xml/validation/ValidatorHandler/index.html#GetSetProperty[GetSetProperty003]
The following test fails running on JDK 1.5.0-beta-b32.
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.run01();
System.out.println("\n");
t.run02();
}
public void run01() {
try {
ValidatorHandler vh = schemaFactory.newSchema().newValidatorHandler();
System.out.println("ValidatorHandler.getProperty(null)");
vh.getProperty(null);
} catch (Exception e) {
if (e instanceof NullPointerException) {
System.out.println("OK");
} else {
System.out.print("Failed. ");
e.printStackTrace();
}
}
}
public void run02() {
try {
ValidatorHandler vh = schemaFactory.newSchema().newValidatorHandler();
System.out.println("ValidatorHandler.setProperty(null, \"123\")");
vh.setProperty(null, "123");
} 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-b32)
Java HotSpot(TM) Client VM (build 1.5.0-beta-b32, mixed mode)
ValidatorHandler.getProperty(null)
Failed. org.xml.sax.SAXNotRecognizedException
at javax.xml.validation.ValidatorHandler.getProperty(ValidatorHandler.java:439)
at test.run01(test.java:19)
at test.main(test.java:9)
ValidatorHandler.setProperty(null, "123")
Failed. org.xml.sax.SAXNotRecognizedException
at javax.xml.validation.ValidatorHandler.setProperty(ValidatorHandler.java:409)
at test.run02(test.java:34)
at test.main(test.java:12)
--------------------------------------------------------------------------
======================================================================
The methods
javax.xml.validation.ValidatorHandler.getProperty()
javax.xml.validation.ValidatorHandler.setProperty()
throw SAXNotRecognizedException instead of NullPointerException in case when a property 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/ValidatorHandler/index.html#GetSetProperty[GetSetProperty001]
api/javax_xml/validation/ValidatorHandler/index.html#GetSetProperty[GetSetProperty003]
The following test fails running on JDK 1.5.0-beta-b32.
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.run01();
System.out.println("\n");
t.run02();
}
public void run01() {
try {
ValidatorHandler vh = schemaFactory.newSchema().newValidatorHandler();
System.out.println("ValidatorHandler.getProperty(null)");
vh.getProperty(null);
} catch (Exception e) {
if (e instanceof NullPointerException) {
System.out.println("OK");
} else {
System.out.print("Failed. ");
e.printStackTrace();
}
}
}
public void run02() {
try {
ValidatorHandler vh = schemaFactory.newSchema().newValidatorHandler();
System.out.println("ValidatorHandler.setProperty(null, \"123\")");
vh.setProperty(null, "123");
} 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-b32)
Java HotSpot(TM) Client VM (build 1.5.0-beta-b32, mixed mode)
ValidatorHandler.getProperty(null)
Failed. org.xml.sax.SAXNotRecognizedException
at javax.xml.validation.ValidatorHandler.getProperty(ValidatorHandler.java:439)
at test.run01(test.java:19)
at test.main(test.java:9)
ValidatorHandler.setProperty(null, "123")
Failed. org.xml.sax.SAXNotRecognizedException
at javax.xml.validation.ValidatorHandler.setProperty(ValidatorHandler.java:409)
at test.run02(test.java:34)
at test.main(test.java:12)
--------------------------------------------------------------------------
======================================================================