diff options
author | Thomas Meyer <[email protected]> | 2012-08-19 16:50:30 +0200 |
---|---|---|
committer | Thomas Meyer <[email protected]> | 2012-08-19 16:50:30 +0200 |
commit | e4ff622c39bc041c309fdff361c951e6312bc6ee (patch) | |
tree | 34316e153f0bd6211cda4fbe4e14323c99d9e9c5 /plugin/icedteanp/java/sun/applet/PluginObjectStore.java | |
parent | bc74d798767c5d23cfc1f599421896e915bb2923 (diff) |
Fix a small bug in the contain() method
Diffstat (limited to 'plugin/icedteanp/java/sun/applet/PluginObjectStore.java')
-rw-r--r-- | plugin/icedteanp/java/sun/applet/PluginObjectStore.java | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/plugin/icedteanp/java/sun/applet/PluginObjectStore.java b/plugin/icedteanp/java/sun/applet/PluginObjectStore.java index b06f7ad..87dec78 100644 --- a/plugin/icedteanp/java/sun/applet/PluginObjectStore.java +++ b/plugin/icedteanp/java/sun/applet/PluginObjectStore.java @@ -45,9 +45,9 @@ import java.util.Map; enum PluginObjectStore { INSTANCE; - private HashMap<Integer, Object> objects = new HashMap<Integer, Object>(); - private HashMap<Integer, Integer> counts = new HashMap<Integer, Integer>(); - private HashMap<Object, Integer> identifiers = new HashMap<Object, Integer>(); + private final Map<Integer, Object> objects = new HashMap<Integer, Object>(); + private final Map<Integer, Integer> counts = new HashMap<Integer, Integer>(); + private final Map<Object, Integer> identifiers = new HashMap<Object, Integer>(); private final Object lock = new Object(); private boolean wrapped = false; @@ -64,20 +64,22 @@ enum PluginObjectStore { } public Integer getIdentifier(Object object) { + if (object == null) + return 0; + synchronized(lock) { - if (object == null) - return 0; return identifiers.get(object); } } public boolean contains(Object object) { - synchronized(lock) { - if (object == null) + if (object != null) { + synchronized(lock) { return identifiers.containsKey(object); - - return false; + } } + return false; + } public boolean contains(int identifier) { |