From e4ff622c39bc041c309fdff361c951e6312bc6ee Mon Sep 17 00:00:00 2001
From: Thomas Meyer <thomas@m3y3r.de>
Date: Sun, 19 Aug 2012 16:50:30 +0200
Subject: Fix a small bug in the contain() method

---
 .../icedteanp/java/sun/applet/PluginObjectStore.java | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

(limited to 'plugin/icedteanp/java/sun/applet/PluginObjectStore.java')

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) {
-- 
cgit v1.2.3