JAXB doesn't unmarshall after updating java from 1.8.0_77 to 1.8.0_121

后端 未结 4 570
遇见更好的自我
遇见更好的自我 2021-01-06 05:42

Yesterday I updated java like posted in the title, now JAXB doesn\'t parse xml anymore. All objects are simply null, nothing seems to be set.

Given this POJO - List

4条回答
  •  醉酒成梦
    2021-01-06 06:36

    I have edited this, as it turns out that the change in the JRE was not technically a bug, but 1.8u91 and previous versions were more lenient, and allowed invalid namespaced XML, and 1.8u101+ breaks if xml is not correctly namespaced.

    I have created an example on GitHub to illustrate the difference. Try two run the two mains NoSchema and WithSchema using 1.8u91, and 1.8u101+ to see the difference in behaviour.

    In my case the XML contained no default namespace, but the elements were not prefixed with the namespace they belonged to (broker.xml). This worked fine in 1.8u91, but failed in 1.8u101. Although upgrading broke our code, this is technically not Oracles fault, since the XML was incorrectly namespaced.

提交回复
热议问题