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

DocumentType.cloneNode() throws java.lang.RuntimeException

    XMLWordPrintable

Details

    • 1.1fcs
    • sparc
    • solaris_7
    • Verified

    Description



      Name: inR10064 Date: 12/15/2000



        JAXP 1.1 method org.w3c.dom.DocumentType.cloneNode(boolean deep) throws
      java.lang.RuntimeException when it is used to clone the DocumentType object (See
      test.java below).
        
      This bug is found in builds jaxp-1.1ea-b07, jaxp-1.1ea-b08, jaxp-1.1ea-b09,
      jaxp-1.1ea2-b10, jaxp-1.1ea2-b11, jaxp-1.1ea2-b12, jaxp-1.1ea2-b13, jaxp-1.1ea2-b14,
      jaxp-1.1ea2-b15 and affects the new tests in TCK JAXP 1.1:

      api/org_w3c_dom/Node/CloneNodeTests.html#cloneNodeTest03
      api/org_w3c_dom/Node/CloneNodeTests.html#cloneNodeTest04

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

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

                  String data =
                  "<?xml version=\"1.0\" ?>" +
                  "<!DOCTYPE root [" +
                  "<!ELEMENT root ANY>" +
                  "<!ENTITY ent \"foo\">" +
                  "]>" +
                  "<root/>";
              
                  ByteArrayInputStream in = new ByteArrayInputStream(data.getBytes());

                  Document document = documentBuilder.parse(in);
              
                  Node dtd = document.getDoctype();
                  
                  //try to clone
                  Node dtdClone = dtd.cloneNode(true);
              } 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.RuntimeException: NYI -- dtd clone.
              at org.apache.crimson.tree.Doctype.cloneNode(Doctype.java:183)
              at test.main(test.java:30)
      ---------------------------------------------------------------------------

      ======================================================================

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: