xerces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mrgla...@apache.org
Subject svn commit: r693487 - /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dtd/XMLDTDValidator.java
Date Tue, 09 Sep 2008 15:37:04 GMT
Author: mrglavas
Date: Tue Sep  9 08:37:04 2008
New Revision: 693487

URL: http://svn.apache.org/viewvc?rev=693487&view=rev
Log:
Fixing a potential NPE. The Javadoc for XMLGrammarPool.retrieveInitialGrammarSet() doesn't
explicitly disallow null as a return value. It's possible that some user implementations will
return null.

Modified:
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dtd/XMLDTDValidator.java

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dtd/XMLDTDValidator.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dtd/XMLDTDValidator.java?rev=693487&r1=693486&r2=693487&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dtd/XMLDTDValidator.java
(original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dtd/XMLDTDValidator.java
Tue Sep  9 08:37:04 2008
@@ -667,9 +667,10 @@
 
         // call handlers
         // get initial grammars
-        if(fGrammarPool != null) {
+        if (fGrammarPool != null) {
             Grammar [] grammars = fGrammarPool.retrieveInitialGrammarSet(XMLGrammarDescription.XML_DTD);
-            for(int i = 0; i<grammars.length; i++) {
+            final int length = (grammars != null) ? grammars.length : 0;
+            for (int i = 0; i < length; ++i) {
                 fGrammarBucket.putGrammar((DTDGrammar)grammars[i]);
             }
         }



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


Mime
View raw message