Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8156290 | 8u111 | Aleksej Efimov | P3 | Resolved | Fixed | b01 |
JDK-8150834 | 8u102 | Aleksej Efimov | P3 | Resolved | Fixed | b01 |
JDK-8162133 | emb-8u111 | Aleksej Efimov | P3 | Resolved | Fixed | b01 |
When an xsd that contains annotations is validated with the feature "http://apache.org/xml/features/validate-annotations" enabled, validation fails throwing a NullPointerException:
Exception in thread "main" java.lang.NullPointerException at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.reset(XMLEntityManager.java:1525) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.resetCommon(XML11Configuration.java:1051) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:838) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:805) at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.validateAnnotations(XSDHandler.java:685) at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.parseSchema(XSDHandler.java:665) at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadSchema(XMLSchemaLoader.java:612) at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadGrammar(XMLSchemaLoader.java:571) at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadGrammar(XMLSchemaLoader.java:537) at com.sun.org.apache.xerces.internal.jaxp.validation.XMLSchemaFactory.newSchema(XMLSchemaFactory.java:266) at javax.xml.validation.SchemaFactory.newSchema(SchemaFactory.java:649)
Following code snippet to reproduce:
SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
// "http://apache.org/xml/features/validate-annotations"
factory.setFeature(Constants.XERCES_FEATURE_PREFIX + Constants.VALIDATE_ANNOTATIONS_FEATURE, true); factory.newSchema(new File(XSDValidator.class.getResource("testxsd.xsd").getFile()));
This is the xsd content:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:annotation>
<xs:appinfo>Testapp for XSD annotation issue</xs:appinfo>
<xs:documentation xml:lang="en">This is an XSD annotation, just for the sake of it.</xs:documentation>
</xs:annotation>
</xs:schema>
Exception in thread "main" java.lang.NullPointerException at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.reset(XMLEntityManager.java:1525) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.resetCommon(XML11Configuration.java:1051) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:838) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:805) at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.validateAnnotations(XSDHandler.java:685) at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.parseSchema(XSDHandler.java:665) at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadSchema(XMLSchemaLoader.java:612) at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadGrammar(XMLSchemaLoader.java:571) at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadGrammar(XMLSchemaLoader.java:537) at com.sun.org.apache.xerces.internal.jaxp.validation.XMLSchemaFactory.newSchema(XMLSchemaFactory.java:266) at javax.xml.validation.SchemaFactory.newSchema(SchemaFactory.java:649)
Following code snippet to reproduce:
SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
// "http://apache.org/xml/features/validate-annotations"
factory.setFeature(Constants.XERCES_FEATURE_PREFIX + Constants.VALIDATE_ANNOTATIONS_FEATURE, true); factory.newSchema(new File(XSDValidator.class.getResource("testxsd.xsd").getFile()));
This is the xsd content:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:annotation>
<xs:appinfo>Testapp for XSD annotation issue</xs:appinfo>
<xs:documentation xml:lang="en">This is an XSD annotation, just for the sake of it.</xs:documentation>
</xs:annotation>
</xs:schema>
- backported by
-
JDK-8150834 enabling validate-annotations feature for xsd schema with annotation causes NPE
-
- Resolved
-
-
JDK-8156290 enabling validate-annotations feature for xsd schema with annotation causes NPE
-
- Resolved
-
-
JDK-8162133 enabling validate-annotations feature for xsd schema with annotation causes NPE
-
- Resolved
-
- duplicates
-
JDK-8140516 Regression: NPE when validating XSD annotations
-
- Closed
-
- relates to
-
JDK-8150470 JCK: api/xsl/conf/copy/copy19 test failure
-
- Closed
-