Author: mrglavas
Date: Mon Nov 24 20:18:07 2008
New Revision: 720408

URL: http://svn.apache.org/viewvc?rev=720408&view=rev
Log:
Adding a flag to control the mutability of SchemaGrammars.

Modified:
    xerces/java/trunk/src/org/apache/xerces/impl/xs/SchemaGrammar.java
    xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java

Modified: xerces/java/trunk/src/org/apache/xerces/impl/xs/SchemaGrammar.java
URL: 
http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/impl/xs/SchemaGrammar.java?rev=720408&r1=720407&r2=720408&view=diff
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/impl/xs/SchemaGrammar.java 
(original)
+++ xerces/java/trunk/src/org/apache/xerces/impl/xs/SchemaGrammar.java Mon Nov 
24 20:18:07 2008
@@ -101,6 +101,9 @@
     // parsers for annotation support
     private SoftReference fSAXParser = null;
     private SoftReference fDOMParser = null;
+    
+    // is this grammar immutable?  (fully constructed and not changeable)
+    private boolean fIsImmutable = false;
 
     //
     // Constructors
@@ -1309,5 +1312,13 @@
         }
         fAnnotations[fNumAnnotations++] = annotation;
     }
+    
+    public void setImmutable(boolean isImmutable) {
+        fIsImmutable = isImmutable;
+    }
+    
+    public boolean isImmutable() {
+        return fIsImmutable;
+    }
 
 } // class SchemaGrammar

Modified: 
xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java
URL: 
http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java?rev=720408&r1=720407&r2=720408&view=diff
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java 
(original)
+++ xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java 
Mon Nov 24 20:18:07 2008
@@ -975,13 +975,17 @@
     
     private boolean isExistingGrammar(XSDDescription desc) {
         SchemaGrammar sg = 
fGrammarBucket.getGrammar(desc.getTargetNamespace());
-        if(sg == null) {
+        if (sg == null) {
             return findGrammar(desc) != null;
         }
+        else if (sg.isImmutable()) {
+            return true;
+        }
         else {
             try {
                 return 
sg.getDocumentLocations().contains(XMLEntityManager.expandSystemId(desc.getLiteralSystemId(),
 desc.getBaseSystemId(), false));
-            } catch (MalformedURIException e) {
+            } 
+            catch (MalformedURIException e) {
                 return false;
             }
         }



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to