Questionable code for cloneMap in NamedNodeMapImpl.java (Invalid XML written)

XMLWordPrintable

    • Type: Bug
    • Resolution: Incomplete
    • Priority: P4
    • None
    • Affects Version/s: 11
    • Component/s: xml

      A DESCRIPTION OF THE PROBLEM :
      We have detected that an invalid XML file is written when using DOMNormalizer to normalize a document.

      If you look at following code:
      https://github.com/openjdk/jdk/blob/master/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/dom/NamedNodeMapImpl.java#L572:L583

      It is totally different from the implementation in Xerces.
      Is there any reason why this code is different? The Xerces implementation works fine.

      Here's the Xerces implementation:
      http://svn.apache.org/viewvc/xerces/java/tags/Xerces-J_2_12_0/src/org/apache/xerces/dom/NamedNodeMapImpl.java?view=markup#l577

      Highlighting the problem:

       - The Xerces implementation creates a new list when the list parameter is null
       - The JDK implementation ignores the list parameter and overwrite it when "nodes" is not null.



            Assignee:
            Joe Wang
            Reporter:
            Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: