Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4398950

Node.isSupported() throws java.lang.NullPointerException

XMLWordPrintable

    • 1.1fcs
    • sparc
    • solaris_7
    • Verified



      Name: inR10064 Date: 12/18/2000



        The implementation of the method org.w3c.dom.Node.isSupported(String feature, String version) throws
      java.lang.NullPointerException if feature = "xml" and version = null (See test.java below).

        Definition of the method in p. 1.2 "Fundamental Interfaces" of DOM Level 2 Core
      (http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-1950641247) reads:

        " isSupported introduced in DOM Level 2
              ...
              Parameters
              ...
                version of type DOMString
                  This is the version number of the feature to test. In Level 2, version 1, this is the string
                  "2.0". If the version is not specified, supporting any version of the feature will cause the
                  method to return true. "
                  
        This bug is found in builds jaxp-1.1ea2-b12, jaxp-1.1ea2-b13, jaxp-1.1ea2-b14,
      jaxp-1.1ea2-b15 and affects the new test in TCK JAXP 1.1:

      api/org_w3c_dom/Node/IsSupportedTests.html#supportsTest02

      ------------------------------------test.java-----------------------------
      import org.w3c.dom.Document;
      import javax.xml.parsers.DocumentBuilderFactory;
      import javax.xml.parsers.DocumentBuilder;

      public class test {
          
          public static void main(String argv[]) {
              
              try {
                  java.util.Locale.setDefault(java.util.Locale.US);
                  
                  DocumentBuilder documentBuilder = DocumentBuilderFactory.newInstance()
                                                    .newDocumentBuilder();

                  Document document = documentBuilder.newDocument();

                  document.isSupported("xml", null);
              } catch (Exception e) {
                  e.printStackTrace();
              }
          }
      }
      ---------------------------------------------------------------------------
      ---------------------------------------------------------------------------
      % java -showversion -cp .:jaxp1.1ea/jaxp.jar:jaxp1.1ea/crimson.jar test
      java version "1.3.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
      Java HotSpot(TM) Client VM (build 1.3.0-C, interpreted mode)

      java.lang.NullPointerException
              at org.apache.crimson.tree.DOMImplementationImpl.hasFeature0(DOMImplementationImpl.java:97)
              at org.apache.crimson.tree.NodeBase.isSupported(NodeBase.java:362)
              at test.main(test.java:17)
      ---------------------------------------------------------------------------
            
      ======================================================================

            egoei Edwin Goei (Inactive)
            inevsunw Inev Inev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: