Rothamsted / knetbuilder

KnetBuilder data integration platform for building knowledge graphs. Previously known as ondex.
https://knetminer.com
MIT License
12 stars 11 forks source link

OXL exporter combined with JAXB generates wrong results with newlines, due to recent JDK 1.8 bug #14

Closed marco-brandizi closed 6 years ago

marco-brandizi commented 6 years ago

This is to keep track of a recent fix about the OXL exporter.

Reporting the same text in comments:

This is to fix bug in JDK >8u151

In short, when some text is serialised to XML using JAXB, newlines are wrongly escaped by an internal JDK component.

If you see how they patched it, the problem is that at some point in the XML-writing pipeline XMLStreamWriter.writeEntityRef(String) is called with the wrong code '#xa' or '#xd' (corresponding to '\r' or '\n'). This is produced by some JDK-internal escape handler (again, see their linked patch).

Waiting for the release of a new JDK, we do as they do in the fix: our writeEntityRef(String) wrapper re-writes \r or \n if it sees one of the wrong codes, thus eliminating the wrong escaping that happens in the JDK.

TODO: hopefully, this fix won't be needed anymore once JDK8u192 is released (or if you manage to move to JDK >8), so we will be able to remove this wrapper from Export.start()

This was first fixed and then I'm filing this issue and closing it immediately.

marco-brandizi commented 6 years ago

Fixed by 98e9ed2af977a7196ba534b7d8840fe98e2c7a68