-
Bug
-
Resolution: Fixed
-
P3
-
8, 9
-
b113
-
Not verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8156296 | 8u111 | Aleksej Efimov | P3 | Resolved | Fixed | b01 |
JDK-8153296 | 8u102 | Aleksej Efimov | P3 | Resolved | Fixed | b02 |
JDK-8162139 | emb-8u111 | Aleksej Efimov | P3 | Resolved | Fixed | b01 |
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
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
- backported by
-
JDK-8153296 Unmarshaller unmarshalls XML element which doesn't have the expected namespace
-
- Resolved
-
-
JDK-8156296 Unmarshaller unmarshalls XML element which doesn't have the expected namespace
-
- Resolved
-
-
JDK-8162139 Unmarshaller unmarshalls XML element which doesn't have the expected namespace
-
- Resolved
-
- relates to
-
JDK-8150174 Update JAX-WS RI integration to latest version (2.3.0-SNAPSHOT)
-
- Resolved
-
-
JDK-8153262 javax/xml/bind/marshal/8134111/UnmarshalTest.java fails
-
- Closed
-
-
JDK-8165299 Jaxb unmarshaller stopped working in jdk 102
-
- Closed
-
(1 relates to)