You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by mr...@apache.org on 2010/07/18 17:30:10 UTC

svn commit: r965245 - /xerces/java/trunk/src/org/apache/xerces/parsers/AbstractSAXParser.java

Author: mrglavas
Date: Sun Jul 18 15:30:10 2010
New Revision: 965245

URL: http://svn.apache.org/viewvc?rev=965245&view=rev
Log:
Fixing an NPE. The application may have set the ContentHandler / DocumentHandler to null within setDocumentLocator() so we need to check for null again before calling startDocument().

Modified:
    xerces/java/trunk/src/org/apache/xerces/parsers/AbstractSAXParser.java

Modified: xerces/java/trunk/src/org/apache/xerces/parsers/AbstractSAXParser.java
URL: http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/parsers/AbstractSAXParser.java?rev=965245&r1=965244&r2=965245&view=diff
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/parsers/AbstractSAXParser.java (original)
+++ xerces/java/trunk/src/org/apache/xerces/parsers/AbstractSAXParser.java Sun Jul 18 15:30:10 2010
@@ -262,7 +262,11 @@ public abstract class AbstractSAXParser
                 if (locator != null) {
                     fDocumentHandler.setDocumentLocator(new LocatorProxy(locator));
                 }
-                fDocumentHandler.startDocument();
+                // The application may have set the DocumentHandler to null
+                // within setDocumentLocator() so we need to check again.
+                if (fDocumentHandler != null) {
+                    fDocumentHandler.startDocument();
+                }
             }
 
             // SAX2
@@ -270,7 +274,11 @@ public abstract class AbstractSAXParser
                 if (locator != null) {
                     fContentHandler.setDocumentLocator(new LocatorProxy(locator));
                 }
-                fContentHandler.startDocument();
+                // The application may have set the ContentHandler to null
+                // within setDocumentLocator() so we need to check again.
+                if (fContentHandler != null) {
+                    fContentHandler.startDocument();
+                }  
             }
         }
         catch (SAXException e) {



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org