JDK-7131589 : Bug 13586966 - NPE IN PARSERCONFIGURATIONSETTINGS.ADDRECOGNIZEDFEATURES
  • Type: Bug
  • Component: xml
  • Sub-Component: jaxp
  • Affected Version: 7
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2012-01-19
  • Updated: 2012-09-28
  • Resolved: 2012-03-05
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7
7u4 b11Fixed
Related Reports
Relates :  
Description
@ 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(); 
@ . 
@     } 
@ } 
@ .

Comments
EVALUATION The issue is not reproducible therefore the CR has been closed as unverified.
05-03-2012

EVALUATION Fix in jdk7u-dev, see also 7133220.
03-02-2012

EVALUATION Using different impls in a mix-and-match fashion can cause problems like this and need to be very careful. If no particular reason, it should be avoided. That said, since jaxp does support the usage, I'll fix it in the next release.
19-01-2012