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

REGRESSION: SAXParserFactory throws FactoryConfigurationError if contextClassLoader=null

XMLWordPrintable

    • b92
    • x86
    • linux, windows_xp

      FULL PRODUCT VERSION :
      java version "1.6.0-rc"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.6.0-rc-b60)
      Java HotSpot(TM) Client VM (build 1.6.0-rc-b60, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP [Version 5.1.2600]

      A DESCRIPTION OF THE PROBLEM :
      SAXParserFactory.newInstance() throws FactoryConfigurationError if in current contextClassLoader=null. Version 1.5_04, 1.5_05 works ok. As result of this change of the behaviour, maven tool can't work under mustang.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run example

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      SAXParserFactory.newInstance() expected to use system loader when there is no context one.
      ACTUAL -
      Exception is thrown

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      C:\>java -showversion -Djaxp.debug=1 JAXPTest
      java version "1.6.0-rc"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.6.0-rc-b60)
      Java HotSpot(TM) Client VM (build 1.6.0-rc-b60, mixed mode, sharing)

      JAXP: find factoryId =javax.xml.parsers.SAXParserFactory
      JAXP: found jar resource=META-INF/services/javax.xml.parsers.SAXParserFactory using ClassLoader: nul
      l
      JAXP: found in resource, value=com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl
      Exception in thread "main" javax.xml.parsers.FactoryConfigurationError: Provider com.sun.org.apache.
      xerces.internal.jaxp.SAXParserFactoryImpl could not be instantiated: java.lang.NullPointerException
              at javax.xml.parsers.SAXParserFactory.newInstance(Unknown Source)
              at JAXPTest.main(JAXPTest.java:8)

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import javax.xml.parsers.SAXParserFactory;

      public class JAXPTest
      {
       public static void main(String[] args) throws Exception
       {
        Thread.currentThread().setContextClassLoader(null);
        SAXParserFactory.newInstance();
       }
      }

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Don't set context class loader to null.

      Release Regression From : 5.0u5
      The above release value was the last known release where this
      bug was known to work. Since then there has been a regression.

            spericas Santiago Pericasgeertsen
            rmandalasunw Ranjith Mandala (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: