I found some strange code in OpenJDK JAXB:
com.sun.xml.internal.bind.v2.model.impl.ModelBuilder
try {
XmlSchema s = null;
s.location();
} catch (NullPointerException e) {
// as expected
} catch (NoSuchMethodError e) {
...
}
Can some explain why they do this? Or this is just a bad code need to fix.
They are using this code as a test to determine which version of the JAXB (JSR-222) APIs are being used. The location
parameter was added to @XmlSchema
in JAXB 2.1, if NoSuchMethodError
was thrown then JAXB 2.0 APIs are being used.
See Lines 158-177
Javadoc - @XmlSchema.location
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With