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

[email protected]
Newsgroups gmane.text.xml.xindice.devel
Message-ID <[email protected]>
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;
     }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.