Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2076372 | 5.0 | Ramesh Mandava | P3 | Closed | Fixed | b30 |
Name: eaR10174 Date: 10/27/2003
The following methods of the class javax.xml.xpath.XPath
public void setFunctionResolver(XPathFunctionResolver resolver)
public void setNamespaceContext(NamespaceContext nsContext)
public void setVariableResolver(XPathVariableResolver resolver)
do not throw NullPointerException in case when null is passed to them (see test.java
below). According to the javadoc
public void setFunctionResolver(XPathFunctionResolver resolver)
...
A NullPointerException is trown if resolver is null.
public void setNamespaceContext(NamespaceContext nsContext)
...
A NullPointerException is trown if resolver is null
public void setVariableResolver(XPathVariableResolver resolver)
...
A NullPointerException is trown if resolver is null.
the methods should throw NullPointerException in such a case.
The bug appears in jdk1.5.0beta-b25 and affects new JCK1.5 tests:
api/javax_xml/xpath/XPath/index.html#SetGet[SetGet003]
api/javax_xml/xpath/XPath/index.html#SetGet[SetGet006]
api/javax_xml/xpath/XPath/index.html#SetGet[SetGet009]
------------------------------------test.java-----------------------------
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathFactory;
public class test {
public static void main (String[] args) {
try {
XPathFactory xpf = XPathFactory.newInstance();
XPath xpath = xpf.newXPath();
try {
xpath.setFunctionResolver(null);
System.out.println("setFunctionResolver: NPE not thrown.");
} catch (NullPointerException e) {
System.out.println("setFunctionResolver: OK");
}
try {
xpath.setNamespaceContext(null);
System.out.println("setNamespaceContext: NPE not thrown.");
} catch (NullPointerException e) {
System.out.println("setNamespaceContext: OK");
}
try {
xpath.setVariableResolver(null);
System.out.println("setVariableResolver: NPE not thrown.");
} catch (NullPointerException e) {
System.out.println("setVariableResolver: OK");
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
--------------------------------------------------------------------------
% java -showversion test
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b25)
Java HotSpot(TM) Client VM (build 1.5.0-beta-b25, mixed mode)
setFunctionResolver: NPE not thrown.
setNamespaceContext: NPE not thrown.
setVariableResolver: NPE not thrown.
--------------------------------------------------------------------------
======================================================================
- backported by
-
JDK-2076372 XPath.setXXX() methods do not throw NullPointerException
- Closed