changeset 692:f246770bcc78

Merge
author mullan
date Thu, 30 Oct 2008 17:28:35 -0400
parents cdfb6f963a60 4ff842aee1fd
children 8d17cc67a857 5102df668164
files
diffstat 1 files changed, 11 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/sun/org/apache/xml/internal/security/utils/IdResolver.java	Thu Oct 30 18:19:48 2008 +0100
+++ b/src/share/classes/com/sun/org/apache/xml/internal/security/utils/IdResolver.java	Thu Oct 30 17:28:35 2008 -0400
@@ -70,10 +70,13 @@
      */
     public static void registerElementById(Element element, String idValue) {
         Document doc = element.getOwnerDocument();
-        WeakHashMap elementMap = (WeakHashMap) docMap.get(doc);
-        if(elementMap == null) {
-            elementMap = new WeakHashMap();
-            docMap.put(doc, elementMap);
+        WeakHashMap elementMap;
+        synchronized (docMap) {
+            elementMap = (WeakHashMap) docMap.get(doc);
+            if (elementMap == null) {
+                elementMap = new WeakHashMap();
+                docMap.put(doc, elementMap);
+            }
         }
         elementMap.put(idValue, new WeakReference(element));
     }
@@ -153,7 +156,10 @@
     private static Element getElementByIdType(Document doc, String id) {
         if (log.isLoggable(java.util.logging.Level.FINE))
             log.log(java.util.logging.Level.FINE, "getElementByIdType() Search for ID " + id);
-        WeakHashMap elementMap = (WeakHashMap) docMap.get(doc);
+        WeakHashMap elementMap;
+        synchronized (docMap) {
+            elementMap = (WeakHashMap) docMap.get(doc);
+        }
         if (elementMap != null) {
             WeakReference weakReference = (WeakReference) elementMap.get(id);
             if (weakReference != null) {