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

Namespaces are not always returned in same order

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Not an Issue
    • Affects Version/s: 8
    • Fix Version/s: 8
    • Component/s: core-libs
    • Labels:

      Description

      A test which uses namespaceDeclarations() fails on ocassion as the namespaces do not seem to be returned in the expected order (of declaration).
      I think namespaces are added into HashMaps (XmlNode.java) and a recent change to HashMaps seems to have change this order (which is documented to be not guaranteed).
      I think namespaces could be stored in a sorted collection so the array returned contains the expected order, or this is a test bug and it should not assume the order of returned values.

      The test is below. foo and bar are mixed on ocassion.
      failing tonga test:
      rhino17r3/tests/e4xc

      8<----------------------------------------------------------
      gTestfile = '13.4.4.24.js';

      START("13.4.4.24 - XML namespaceDeclarations()");

      TEST(1, true, XML.prototype.hasOwnProperty("namespaceDeclarations"));
         
      x =
      <foo:alpha xmlns:foo="http://foo/" xmlns:bar="http://bar/">
          <foo:bravo>one</foo:bravo>
      </foo:alpha>;

      y = x.namespaceDeclarations();

      TEST(2, 2, y.length);
      TEST(3, "object", typeof(y[0]));
      TEST(4, "object", typeof(y[1]));
      TEST(5, "foo", y[0].prefix);
      TEST(6, Namespace("http://foo/"), y[0]);
      TEST(7, "bar", y[1].prefix);
      TEST(8, Namespace("http://bar/"), y[1]);

      END();

        Attachments

          Activity

            People

            • Assignee:
              sundar Sundararajan Athijegannathan
              Reporter:
              ssides Steve Sides
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: