Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-7131589

Bug 13586966 - NPE IN PARSERCONFIGURATIONSETTINGS.ADDRECOGNIZEDFEATURES

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2
    • Resolution: Fixed
    • Affects Version/s: 7
    • Fix Version/s: 7u4
    • Component/s: xml
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b11
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      Not verified

      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();
      @ .
      @ }
      @ }
      @ .

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                joehw Joe Wang
                Reporter:
                joehw Joe Wang
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: