You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by ji...@apache.org on 2004/04/23 20:05:53 UTC

[jira] Closed: (XERCESJ-908) NullPointerException on invoking doc.getFeature("XPath", nullVersion)

Message:

   The following issue has been closed.

   Resolver: Michael Glavassevich
       Date: Fri, 23 Apr 2004 11:04 AM

Closed as per state in Bugzilla.
---------------------------------------------------------------------
View the issue:
  http://issues.apache.org/jira/browse/XERCESJ-908

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: XERCESJ-908
    Summary: NullPointerException on invoking doc.getFeature("XPath", nullVersion)
       Type: Bug

     Status: Closed
 Resolution: FIXED

    Project: Xerces2-J
 Components: 
             DOM
   Versions:
             2.6.2

   Assignee: Michael Glavassevich
   Reporter: Naela Nissar

    Created: Wed, 3 Mar 2004 10:17 PM
    Updated: Fri, 23 Apr 2004 11:04 AM
Environment: Operating System: Other
Platform: Other

Description:
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;
            }
        }


---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org