eclipse-ee4j / jaxb-ri

Jaxb RI
https://eclipse-ee4j.github.io/jaxb-ri/
BSD 3-Clause "New" or "Revised" License
203 stars 111 forks source link

prefix-mapping is not predictable #1069

Open Tomas-Kraus opened 9 years ago

Tomas-Kraus commented 9 years ago

If you generate XML which includes other XML's, you might have a different default namespace in two different javax.xml.bind.annotation.XmlNs in package-info.

In the current implementation of com.sun.xml.bind.v2.runtime.JAXBContextImpl it is not predictable which of the two will win. Actually in java 7 I get other ones that in java 8.

I propose to change

xmlNsSet = new HashSet<XmlNs>();

in

xmlNsSet = new LinkedHashSet<XmlNs>();

(at line 327)

I think this will fix it. The set will be at insertion order, and we will not end up with 'ns3' for our current default namespace...

Affected Versions

[2.2.11]

Tomas-Kraus commented 6 years ago
Tomas-Kraus commented 9 years ago

@glassfishrobot Commented Reported by mihxil

Tomas-Kraus commented 9 years ago

@glassfishrobot Commented yaroska said: Can you please provide simple testcase to cover this issue? Thanks.

Tomas-Kraus commented 9 years ago

@glassfishrobot Commented Was assigned to yaroska

Tomas-Kraus commented 7 years ago

@glassfishrobot Commented This issue was imported from java.net JIRA JAXB-1069