You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2019/06/25 22:52:43 UTC

[GitHub] [netbeans] paulward24 opened a new pull request #1328: HashMap is not thread safe. Field map is typically synchronized by this. However, in two places, field map is not protected with synchronized.

paulward24 opened a new pull request #1328: HashMap is not thread safe. Field map is typically synchronized by this. However, in two places, field map is not protected with synchronized.
URL: https://github.com/apache/netbeans/pull/1328
 
 
   The current field
   
   ```map```
   
   https://github.com/apache/netbeans/blob/master/platform/openide.filesystems/src/org/openide/filesystems/XMLMapAttr.java#L112
   
   is typically protected by synchronization on ```this```, e.g., 
   
   https://github.com/apache/netbeans/blob/master/platform/openide.filesystems/src/org/openide/filesystems/XMLMapAttr.java#L386
   
   https://github.com/apache/netbeans/blob/master/platform/openide.filesystems/src/org/openide/filesystems/XMLMapAttr.java#L390
   
   https://github.com/apache/netbeans/blob/master/platform/openide.filesystems/src/org/openide/filesystems/XMLMapAttr.java#L426
   
   For a total of 16 locations.
   
   However, in these two places, ```map``` is not protected by synchronization:
   
   https://github.com/apache/netbeans/blob/master/platform/openide.filesystems/src/org/openide/filesystems/XMLMapAttr.java#L207
   
   https://github.com/apache/netbeans/blob/master/platform/openide.filesystems/src/org/openide/filesystems/XMLMapAttr.java#L210
   
   Note that in the same method, only 4 lines above:
   
   https://github.com/apache/netbeans/blob/master/platform/openide.filesystems/src/org/openide/filesystems/XMLMapAttr.java#L202
   
   ```map``` is again protected by synchronization:
   
   ```
   synchronized (this) {
       attr = (Attr) map.get(attrName);
   }
   ```
   
   This CR protected the two instances motioned above (line 207 and
   line 210) with synchronization like in line 202.
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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

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