Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=43470
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Fri, 25 Apr 2008 18:16:36 +0000 (18:16 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Fri, 25 Apr 2008 18:16:36 +0000 (18:16 +0000)
Based on a changes provided by Lucas Galfaso

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@651675 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/deploy/NamingResources.java

index cff5966..468885a 100644 (file)
@@ -320,7 +320,7 @@ public class NamingResources implements Serializable {
             entries.put(resource.getName(), resource.getType());
         }
 
-        synchronized (localEjbs) {
+        synchronized (resourceEnvRefs) {
             resource.setNamingResources(this);
             resourceEnvRefs.put(resource.getName(), resource);
         }
@@ -681,7 +681,7 @@ public class NamingResources implements Serializable {
 
         ContextLocalEjb localEjb = null;
         synchronized (localEjbs) {
-            localEjb = (ContextLocalEjb) ejbs.remove(name);
+            localEjb = (ContextLocalEjb) localEjbs.remove(name);
         }
         if (localEjb != null) {
             support.firePropertyChange("localEjb", localEjb, null);
@@ -755,13 +755,14 @@ public class NamingResources implements Serializable {
 
         entries.remove(name);
 
-        String type = null;
+        ContextResourceEnvRef resourceEnvRef = null;
         synchronized (resourceEnvRefs) {
-            type = (String) resourceEnvRefs.remove(name);
+            resourceEnvRef =
+                (ContextResourceEnvRef) resourceEnvRefs.remove(name);
         }
-        if (type != null) {
-            support.firePropertyChange("resourceEnvRef",
-                                       name + ":" + type, null);
+        if (resourceEnvRef != null) {
+            support.firePropertyChange("resourceEnvRef", resourceEnvRef, null);
+            resourceEnvRef.setNamingResources(null);
         }
 
     }