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

Unmarshaller unmarshalls XML element which doesn't have the expected namespace

    Details

    • Subcomponent:
    • Resolved In Build:
      b113
    • Verification:
      Not verified

      Backports

        Description

        XML that contains unqualified to target namespace elements is successfully unmarshalled when elementFormDefault is set to QUALIFIED. Such elements should be ignored by unmarshaller.

        The following code and xml file illustrates this problem:
        Xml to unmarshall (XML_TO_U):
        <tns:root xmlns:tns="http://www.example.org/testSchema/">
        <tns:when>
        <dtime>2015-06-24T13:16:14.933-04:00</dtime>
        </tns:when>
        </tns:root>

        Jaxb context package information file:
        @javax.xml.bind.annotation.XmlSchema(namespace = "http://www.example.org/testSchema/", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
        package testTypes;

        Main method that does unmarshalling:
        context = JAXBContext.newInstance("testTypes");
        unm = context.createUnmarshaller();
        Object o = unm.unmarshal(new InputSource(new StringReader(XML_TO_U)));
        Root r = (Root)o;
        System.out.println("dtime is:"+r.getWhen().getDtime());

        It is expected that dtime should be null:
        "dtime is:null"
        But the code prints:
        "dtime is:2015-06-24T13:16:14.933-04:00"

        JDK9/8 is affected by this issue

          Issue Links

            Activity

            Hide
            aefimov Aleksej Efimov added a comment -
            This bug was fixed in JDK9 as part of sync process with standalone JAXWS project. See JDK-8150174 for details. Changes to StructureLoader class solves the reported issue:
            http://hg.openjdk.java.net/jdk9/dev/jaxws/rev/ebff1bd3627a#l2.1
            Show
            aefimov Aleksej Efimov added a comment - This bug was fixed in JDK9 as part of sync process with standalone JAXWS project. See JDK-8150174 for details. Changes to StructureLoader class solves the reported issue: http://hg.openjdk.java.net/jdk9/dev/jaxws/rev/ebff1bd3627a#l2.1
            Hide
            hgupdate HG Updates added a comment -
            URL: http://hg.openjdk.java.net/jdk9/dev/jdk/rev/4bd4c8c2a922
            User: aefimov
            Date: 2016-04-01 09:34:57 +0000
            Show
            hgupdate HG Updates added a comment - URL: http://hg.openjdk.java.net/jdk9/dev/jdk/rev/4bd4c8c2a922 User: aefimov Date: 2016-04-01 09:34:57 +0000
            Hide
            hgupdate HG Updates added a comment -
            URL: http://hg.openjdk.java.net/jdk9/jdk9/jdk/rev/4bd4c8c2a922
            User: lana
            Date: 2016-04-06 18:32:35 +0000
            Show
            hgupdate HG Updates added a comment - URL: http://hg.openjdk.java.net/jdk9/jdk9/jdk/rev/4bd4c8c2a922 User: lana Date: 2016-04-06 18:32:35 +0000

              People

              • Assignee:
                aefimov Aleksej Efimov
                Reporter:
                shadowbug Shadow Bug
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: