You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xindice-dev@xml.apache.org by vg...@apache.org on 2007/04/12 00:20:29 UTC

svn commit: r527707 - /xml/xindice/trunk/java/src/org/apache/xindice/xml/SymbolTable.java

Author: vgritsenko
Date: Wed Apr 11 15:20:28 2007
New Revision: 527707

URL: http://svn.apache.org/viewvc?view=rev&rev=527707
Log:
synchronize streamToXML to avoid ConcModEx / ensure consistent result (from bug #42026)

Modified:
    xml/xindice/trunk/java/src/org/apache/xindice/xml/SymbolTable.java

Modified: xml/xindice/trunk/java/src/org/apache/xindice/xml/SymbolTable.java
URL: http://svn.apache.org/viewvc/xml/xindice/trunk/java/src/org/apache/xindice/xml/SymbolTable.java?view=diff&rev=527707&r1=527706&r2=527707
==============================================================================
--- xml/xindice/trunk/java/src/org/apache/xindice/xml/SymbolTable.java (original)
+++ xml/xindice/trunk/java/src/org/apache/xindice/xml/SymbolTable.java Wed Apr 11 15:20:28 2007
@@ -198,16 +198,18 @@
     public final Element streamToXML(Document doc) throws DOMException {
         Element root = doc.createElement(SYMBOLS);
 
-        Iterator list = symbols.values().iterator();
-        while (list.hasNext()) {
-            SymbolInfo info = (SymbolInfo) list.next();
-            Element e = doc.createElement(SYMBOL);
-            e.setAttribute(NAME, info.qname);
-            if (info.namespaceURI != null && info.namespaceURI.length() > 0) {
-                e.setAttribute(NSURI, info.namespaceURI);
+        synchronized (symbols) {
+            Iterator list = symbols.values().iterator();
+            while (list.hasNext()) {
+                SymbolInfo info = (SymbolInfo) list.next();
+                Element e = doc.createElement(SYMBOL);
+                e.setAttribute(NAME, info.qname);
+                if (info.namespaceURI != null && info.namespaceURI.length() > 0) {
+                    e.setAttribute(NSURI, info.namespaceURI);
+                }
+                e.setAttribute(ID, Short.toString(info.symbol));
+                root.appendChild(e);
             }
-            e.setAttribute(ID, Short.toString(info.symbol));
-            root.appendChild(e);
         }
         return root;
     }