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

REGRESSION: NPE calling javax.xml.parsers.DocumentBuilder.parse()

XMLWordPrintable

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


      ADDITIONAL OS VERSION INFORMATION :
      Linux unununium 2.4.21-20.EL #1 Wed Aug 18 20:58:25 EDT 2004 i686 i686 i386 GNU/Linux


      EXTRA RELEVANT SYSTEM CONFIGURATION :
      $ cat /proc/cpuinfo
      processor : 0
      vendor_id : GenuineIntel
      cpu family : 15
      model : 3
      model name : Intel(R) Pentium(R) 4 CPU 2.80GHz
      stepping : 3
      cpu MHz : 2793.051
      cache size : 1024 KB
      fdiv_bug : no
      hlt_bug : no
      f00f_bug : no
      coma_bug : no
      fpu : yes
      fpu_exception : yes
      cpuid level : 5
      wp : yes
      flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm
      bogomips : 5570.56


      A DESCRIPTION OF THE PROBLEM :
      I get a java.lang.NullPointerException when parsing a large xml document. The parsing is done with javax.xml.parsers.DocumentBuilder.parse(). The original document was about 2.5 MB, but was able to get it to fail with documents as small as about 390 KB.

      This problem is new to 5.0. I can compile the test program I have included with jdk 1.4.2_04, and it successfully parses the xml document from the file.

      This problem does not occur with all large xml documents. I will provide a sample document that will cause the failure.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Compile and run provided XMLParseTest code. Give the filename of the xml file as a parameter to the test program. Make sure the dtd file is located in the same directory as the xml file.

      Get the xml and dtd files from:

      ftp://ftp.avamar.com/pub/files/sun/x6.xml
      ftp://ftp.avamar.com/pub/files/sun/event_catalog.dtd

      Here are the MD5 checksums for these files:

      5cb8504288d0de0f66cdc2d62d7c3c85 x6.xml
      04fc7179546f9a624a771803ed131905 event_catalog.dtd



      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The test program produces no output if it doesn't get an exception calling parse().
      ACTUAL -
      java.lang.NullPointerException
              at com.sun.org.apache.xerces.internal.dom.DeferredDocumentImpl.setChunkIndex(DeferredDocumentImpl.java:1980)
              at com.sun.org.apache.xerces.internal.dom.DeferredDocumentImpl.insertBefore(DeferredDocumentImpl.java:784)
              at com.sun.org.apache.xerces.internal.parsers.AbstractDOMParser.endGeneralEntity(AbstractDOMParser.java:1617)
              at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.endGeneralEntity(XMLDTDValidator.java:1108)
              at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.endEntity(XMLDocumentFragmentScannerImpl.java:669)
              at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.endEntity(XMLDocumentScannerImpl.java:556)
              at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.endEntity(XMLEntityManager.java:1779)
              at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.load(XMLEntityScanner.java:1758)
              at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.scanContent(XMLEntityScanner.java:694)
              at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanContent(XMLDocumentFragmentScannerImpl.java:1051)
              at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1649)
              at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
              at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
              at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
              at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
              at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:250)
              at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:292)
              at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:172)
              at XMLParseTest.<init>(XMLParseTest.java:11)
              at XMLParseTest.main(XMLParseTest.java:21)


      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      See Actual Result .

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.io.*;
      import javax.xml.parsers.*;
      import org.w3c.dom.*;

      public class XMLParseTest
      {
         public XMLParseTest( String inFilename )
         {
            try
            {
               Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse( new File( inFilename ) );
            }
            catch( Exception e )
            {
               e.printStackTrace( System.err );
            }
         }

         public static final void main( String[] args )
         {
            new XMLParseTest( args[ 0 ] );
         }
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      None found.

      Release Regression From : 1.4.2
      The above release value was the last known release where this
      bug was known to work. Since then there has been a regression.
      ###@###.### 10/19/04 05:09 GMT

            joehw Joe Wang
            gmanwanisunw Girish Manwani (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: