@ In WLS, we discovered an issue when using a SchemaFactory from a different
@ version of xerces than bundled with the JDK. See bug 12962723 for details.
@ Synopsis is as follows:
@ .
@ In Java 6, there is an NPE check(
@ public void addRecognizedFeatures(String[] featureIds) {
@ .
@ // add recognized features
@ int featureIdsCount = featureIds != null ? featureIds.length : 0;
@ for (int i = 0; i < featureIdsCount; i++) {
@ String featureId = featureIds[i];
@ if (!fRecognizedFeatures.contains(featureId)) {
@ fRecognizedFeatures.add(featureId);
@ }
@ }
@ .
@ }
@ .
@ But NPE check disappears in Java7
@ public void addRecognizedFeatures(String[] featureIds) {
@ fRecognizedFeatures.addAll(Arrays.asList(featureIds));
@ } // addRecognizedFeatures(String[])
@ .
@ .
@ This can be easily reproduced with the following test case. Run with JDK7 &
@ nothing on the classpath, it passes. Run with JDK7 and add xercesImpl.jar to
@ the classpath & it fails with the error indicated in the bug.
@ .
@ import javax.xml.validation.Schema;
@ import javax.xml.validation.SchemaFactory;
@ import javax.xml.XMLConstants;
@ import javax.xml.parsers.SAXParserFactory;
@ .
@ public class test {
@ public static void main(String[] args) throws Exception {
@ System.setProperty("javax.xml.parsers.SAXParserFactory",
@
@ "com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl");
@ SAXParserFactory factory = SAXParserFactory.newInstance();
@ System.out.println(factory.getClass().getName());
@ Schema schema = SchemaFactory.newInstance(
@ XMLConstants.W3C_XML_SCHEMA_NS_URI).newSchema();
@ factory.setSchema(schema);
@ factory.newSAXParser();
@ .
@ }
@ }
@ .
@ version of xerces than bundled with the JDK. See bug 12962723 for details.
@ Synopsis is as follows:
@ .
@ In Java 6, there is an NPE check(
@ public void addRecognizedFeatures(String[] featureIds) {
@ .
@ // add recognized features
@ int featureIdsCount = featureIds != null ? featureIds.length : 0;
@ for (int i = 0; i < featureIdsCount; i++) {
@ String featureId = featureIds[i];
@ if (!fRecognizedFeatures.contains(featureId)) {
@ fRecognizedFeatures.add(featureId);
@ }
@ }
@ .
@ }
@ .
@ But NPE check disappears in Java7
@ public void addRecognizedFeatures(String[] featureIds) {
@ fRecognizedFeatures.addAll(Arrays.asList(featureIds));
@ } // addRecognizedFeatures(String[])
@ .
@ .
@ This can be easily reproduced with the following test case. Run with JDK7 &
@ nothing on the classpath, it passes. Run with JDK7 and add xercesImpl.jar to
@ the classpath & it fails with the error indicated in the bug.
@ .
@ import javax.xml.validation.Schema;
@ import javax.xml.validation.SchemaFactory;
@ import javax.xml.XMLConstants;
@ import javax.xml.parsers.SAXParserFactory;
@ .
@ public class test {
@ public static void main(String[] args) throws Exception {
@ System.setProperty("javax.xml.parsers.SAXParserFactory",
@
@ "com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl");
@ SAXParserFactory factory = SAXParserFactory.newInstance();
@ System.out.println(factory.getClass().getName());
@ Schema schema = SchemaFactory.newInstance(
@ XMLConstants.W3C_XML_SCHEMA_NS_URI).newSchema();
@ factory.setSchema(schema);
@ factory.newSAXParser();
@ .
@ }
@ }
@ .
- relates to
-
JDK-7133220 Additional patches to JAXP 1.4.5 update 1 for 7u4
-
- Closed
-