src/java.xml/share/classes/com/sun/org/apache/xpath/internal/jaxp/XPathImplUtil.java

Print this page

        

*** 26,35 **** --- 26,36 ---- package com.sun.org.apache.xpath.internal.jaxp; import com.sun.org.apache.xalan.internal.res.XSLMessages; import com.sun.org.apache.xalan.internal.utils.FactoryImpl; import com.sun.org.apache.xml.internal.dtm.DTM; + import com.sun.org.apache.xpath.internal.axes.LocPathIterator; import com.sun.org.apache.xpath.internal.objects.XObject; import com.sun.org.apache.xpath.internal.res.XPATHErrorResources; import java.io.IOException; import javax.xml.namespace.QName; import javax.xml.parsers.DocumentBuilderFactory;
*** 71,80 **** --- 72,87 ---- * @throws javax.xml.transform.TransformerException If the expression cannot be evaluated. */ XObject eval(Object contextItem, com.sun.org.apache.xpath.internal.XPath xpath) throws javax.xml.transform.TransformerException { com.sun.org.apache.xpath.internal.XPathContext xpathSupport; + if (contextItem == null && xpath.getExpression() instanceof LocPathIterator) { + // the operation must have no dependency on the context that is null + throw new TransformerException(XSLMessages.createXPATHMessage( + XPATHErrorResources.ER_CONTEXT_CAN_NOT_BE_NULL, + new Object[] {})); + } if (functionResolver != null) { JAXPExtensionsProvider jep = new JAXPExtensionsProvider( functionResolver, featureSecureProcessing, featureManager); xpathSupport = new com.sun.org.apache.xpath.internal.XPathContext(jep); } else {