< prev index next >

src/java.xml/share/classes/com/sun/org/apache/xerces/internal/parsers/XML11Configuration.java

Print this page

        

@@ -413,13 +413,16 @@
     /** Current Datatype validator factory. */
     protected DTDDVFactory fCurrentDVFactory;
     /** Current DTD scanner. */
     protected XMLDTDScanner fCurrentDTDScanner;
 
-    /** Flag indiciating whether XML11 components have been initialized. */
+    /** Flag indicating whether XML11 components have been initialized. */
     private boolean f11Initialized = false;
 
+    /** Flag indicating whether the symbol table instance was specified during construction **/
+    private boolean fSymbolTableProvided = false;
+
     //
     // Constructors
     //
 
     /** Default constructor. */

@@ -564,14 +567,17 @@
             JdkXmlUtils.CATALOG_RESOLVE,
             JdkXmlUtils.CDATA_CHUNK_SIZE
         };
         addRecognizedProperties(recognizedProperties);
 
-        if (symbolTable == null) {
-                symbolTable = new SymbolTable();
-        }
+        // Remember if symbolTable was provided from outside
+        fSymbolTableProvided = symbolTable != null;
+        if (!fSymbolTableProvided) {
+            fSymbolTable = new SymbolTable();
+        } else {
         fSymbolTable = symbolTable;
+        }
         fProperties.put(SYMBOL_TABLE, fSymbolTable);
 
         fGrammarPool = grammarPool;
         if (fGrammarPool != null) {
                         fProperties.put(XMLGRAMMAR_POOL, fGrammarPool);

@@ -838,10 +844,17 @@
         if (fInputSource != null) {
             try {
                 fValidationManager.reset();
                 fVersionDetector.reset(this);
                 fConfigUpdated = true;
+
+                // Reset the symbol table if it wasn't provided during construction
+                if (!fSymbolTableProvided) {
+                    fSymbolTable = new SymbolTable();
+                }
+                fProperties.put(SYMBOL_TABLE, fSymbolTable);
+
                 resetCommon();
 
                 short version = fVersionDetector.determineDocVersion(fInputSource);
                 if (version == Constants.XML_VERSION_1_1) {
                     initXML11Components();
< prev index next >