You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by ma...@apache.org on 2019/07/23 19:13:39 UTC

[netbeans] branch master updated: HashMap is not thread safe. Field map is typically synchronized by this. However, in two places, field map is not protected with synchronized.

This is an automated email from the ASF dual-hosted git repository.

matthiasblaesing pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans.git


The following commit(s) were added to refs/heads/master by this push:
     new 8a3f4d6  HashMap is not thread safe. Field map is typically synchronized by this. However, in two places, field map is not protected with synchronized.
     new ea6d7d9  Merge pull request #1328 from paulward24/master
8a3f4d6 is described below

commit 8a3f4d65bc5942d03320d979bd982873379339ae
Author: Adrian Nistor <ad...@amazon.com>
AuthorDate: Tue Jun 25 22:48:39 2019 +0000

    HashMap is not thread safe. Field map is typically synchronized by this. However, in two places, field map is not protected with synchronized.
---
 .../src/org/openide/filesystems/XMLMapAttr.java                   | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/platform/openide.filesystems/src/org/openide/filesystems/XMLMapAttr.java b/platform/openide.filesystems/src/org/openide/filesystems/XMLMapAttr.java
index 628cc29..6f0a704 100644
--- a/platform/openide.filesystems/src/org/openide/filesystems/XMLMapAttr.java
+++ b/platform/openide.filesystems/src/org/openide/filesystems/XMLMapAttr.java
@@ -204,10 +204,14 @@ final class XMLMapAttr implements Map {
 
         Object retVal = null;
         if (attr == null && origAttrName.startsWith("class:")) { // NOI18N
-            attr = (Attr) map.get(origAttrName.substring(6));
+            synchronized (this) {
+                attr = (Attr) map.get(origAttrName.substring(6));
+            }
             retVal = attr != null ? attr.getType(params) : null;
         } else if (attr == null && origAttrName.startsWith("raw:")) { // NOI18N
-            attr = (Attr) map.get(origAttrName.substring(4));
+            synchronized (this) {
+                attr = (Attr) map.get(origAttrName.substring(4));
+            }
             if (attr != null && attr.keyIndex == 9) {
                 return attr.methodValue(attr.value, params).getMethod();
             }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists