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 2008/09/09 17:39:23 UTC

svn commit: r693488 - /xerces/java/trunk/src/org/apache/xerces/impl/xs/XMLSchemaLoader.java

Author: mrglavas
Date: Tue Sep  9 08:39:23 2008
New Revision: 693488

URL: http://svn.apache.org/viewvc?rev=693488&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/trunk/src/org/apache/xerces/impl/xs/XMLSchemaLoader.java

Modified: xerces/java/trunk/src/org/apache/xerces/impl/xs/XMLSchemaLoader.java
URL: http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/impl/xs/XMLSchemaLoader.java?rev=693488&r1=693487&r2=693488&view=diff
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/impl/xs/XMLSchemaLoader.java (original)
+++ xerces/java/trunk/src/org/apache/xerces/impl/xs/XMLSchemaLoader.java Tue Sep  9 08:39:23 2008
@@ -1026,7 +1026,8 @@
     private void initGrammarBucket(){
         if(fGrammarPool != null) {
             Grammar [] initialGrammars = fGrammarPool.retrieveInitialGrammarSet(XMLGrammarDescription.XML_SCHEMA);
-            for (int i = 0; i < initialGrammars.length; i++) {
+            final int length = (initialGrammars != null) ? initialGrammars.length : 0;
+            for (int i = 0; i < length; ++i) {
                 // put this grammar into the bucket, along with grammars
                 // imported by it (directly or indirectly)
                 if (!fGrammarBucket.putGrammar((SchemaGrammar)(initialGrammars[i]), true)) {



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