Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2078593 | 5.0 | Ramesh Mandava | P3 | Closed | Fixed | b36 |
Name: eaR10174 Date: 12/22/2003
The method
javax.xml.xpath.XPathExpression.evaluate(Object, QName)
throws IllegalArgumentException evaluating simple expressions in the absence of a context item.
The sample below shows failure with the "1+1" expression. According to the javadoc
the method should not throw IAE in such cases.
The bug affects new JCK1.5 tests:
api/javax_xml/xpath/XPathExpression/index.html#Evaluate[Evaluate010]
api/javax_xml/xpath/XPathExpression/index.html#Evaluate[Evaluate011]
api/javax_xml/xpath/XPathExpression/index.html#Evaluate[Evaluate012]
api/javax_xml/xpath/XPathExpression/index.html#Evaluate[Evaluate013]
api/javax_xml/xpath/XPathExpression/index.html#Evaluate[Evaluate014]
api/javax_xml/xpath/XPathExpression/index.html#Evaluate[Evaluate015]
api/javax_xml/xpath/XPathExpression/index.html#Evaluate[Evaluate016]
api/javax_xml/xpath/XPathExpression/index.html#Evaluate[Evaluate017]
api/javax_xml/xpath/XPathExpression/index.html#Evaluate[Evaluate018]
api/javax_xml/xpath/XPathExpression/index.html#Evaluate[Evaluate019]
api/javax_xml/xpath/XPathExpression/index.html#Evaluate[Evaluate020]
api/javax_xml/xpath/XPathExpression/index.html#Evaluate[Evaluate021]
api/javax_xml/xpath/XPathExpression/index.html#Evaluate[Evaluate022]
api/javax_xml/xpath/XPathExpression/index.html#Evaluate[Evaluate023]
api/javax_xml/xpath/XPathExpression/index.html#Evaluate[Evaluate024]
api/javax_xml/xpath/XPathExpression/index.html#Evaluate[Evaluate025]
api/javax_xml/xpath/XPathExpression/index.html#Evaluate[Evaluate026]
api/javax_xml/xpath/XPathExpression/index.html#Evaluate[Evaluate027]
api/javax_xml/xpath/XPathExpression/index.html#Evaluate[Evaluate028]
api/javax_xml/xpath/XPathExpression/index.html#Evaluate[Evaluate030]
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.xpath.XPath;
import javax.xml.xpath.XPathFactory;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpression;
public class test {
public static void main (String[] args) {
try {
XPathFactory xpf = XPathFactory.newInstance(XPathConstants.DOM_OBJECT_MODEL);
XPath xpath = xpf.newXPath();
XPathExpression expr = xpath.compile("1+1");
expr.evaluate((Object)null, XPathConstants.NUMBER);
} catch (Exception e) {
e.printStackTrace();
System.exit(1);
}
}
}
--------------------------------------------------------------------------
% 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)
java.lang.IllegalArgumentException: Node must be non-null for getDTMHandleFromNode
at
com.sun.org.apache.xml.internal.dtm.ref.DTMManagerDefault.getDTMHandleFromNode(DTMManagerDefault.java:512)
at com.sun.org.apache.xpath.internal.XPathContext.getDTMHandleFromNode(XPathContext.java:192)
at com.sun.org.apache.xpath.internal.XPath.execute(XPath.java:272)
at com.sun.org.apache.xpath.internal.jaxp.XPathExpressionImpl.eval(XPathExpressionImpl.java:66)
at com.sun.org.apache.xpath.internal.jaxp.XPathExpressionImpl.evaluate(XPathExpressionImpl.java:118)
at test.main(test.java:13)
--------------------------------------------------------------------------
======================================================================
- backported by
-
JDK-2078593 XPathExpression.evaluate() throws IAE in case of simple expressions
- Closed