DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=27421>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=27421

NullPointerException on invoking doc.getFeature("XPath", nullVersion)

           Summary: NullPointerException on invoking doc.getFeature("XPath",
                    nullVersion)
           Product: Xerces2-J
           Version: 2.6.2
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Minor
          Priority: Other
         Component: DOM
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


Invoking getFeature("XPath", nullVersion) on the document node results in a 
NullPointerException in CoreDocumentImpl.getFeature.  Need to include 
possibility for String version to be null. Currently failing DOM L3 Core test 
case nodegetfeature01. See CoreDOMImplementationImpl.hasFeature for reference. 

Proposed patch in CoreDocumentImpl.getFeature:

public Object getFeature(String feature, String version) {
+     boolean anyVersion = version == null || version.length() == 0;

        if ((feature.equalsIgnoreCase("XPath")
-        || feature.equalsIgnoreCase("+XPath"))&& version.equals("3.0")){
+        || feature.equalsIgnoreCase("+XPath"))&& (anyVersion||version.equals   
+        ("3.0"))){
            try{
                Class xpathClass = ObjectFactory.findProviderClass(
                "org.apache.xpath.domapi.XPathEvaluatorImpl",
                ObjectFactory.findClassLoader(), true);
                fXPathEvaluator = xpathClass.newInstance();
                java.lang.reflect.Method setDocument = xpathClass.getMethod
("setDoc", new Class[]{Document.class});
                setDocument.invoke(fXPathEvaluator, new Object[]{this});
                return fXPathEvaluator;
            }
            catch (Exception e){
                //e.printStackTrace();
                return null;
            }
        }

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to