Page 1 of 1

Running with OpenJDK JAXB-RI [patch]

PostPosted: Mon Dec 12, 2011 2:54 pm
by jeromyevans
The NamespacePrefixMapperUtils.java first assumes that the applicationis running with Sun Java 1.6 by setting com.sun.xml.internal.bind.namespacePrefixMapper to new NamespacePrefixMapperSunInternal().

The code assumes this will fail with a NoClassDefFoundError on a non Java6 systems and then tries to use the JAXB-RI implementation instead.

However on a particular OpenJDK implementation (1.6.0_23) a javax.xml.bind.PropertyException is thrown instead, resulting in the Marshaller not being created with JAXB-RI. I'm not sure why a NoClassDefFoundError isn't thrown. The comments in the code seem to imply it's known PropertyException may be thrown as it's mentioned in the catch statement's comment, but it's not actually caught.

I've attached a patch that catches both NoClassDefFoundError (< Java 1.6) and PropertyException before attempting to use JAXB-RI.

Regards,
Jeromy Evans

Re: Running with OpenJDK JAXB-RI [patch]

PostPosted: Mon Dec 12, 2011 10:50 pm
by jason
Hello Jeremy

Thank you for your patches. This one reminded me to apply to trunk a commit made to the 2.7.1 branch on 13 Nov.

http://www.docx4java.org/trac/docx4j/changeset/1730 is based on your patch.

Could you please try that and let us know any comments.

cheers .. Jason