aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r1204935 - /aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/ReferenceListRecipe.java
Date Tue, 22 Nov 2011 11:46:10 GMT
Author: gnodet
Date: Tue Nov 22 11:46:09 2011
New Revision: 1204935

URL: http://svn.apache.org/viewvc?rev=1204935&view=rev
Log:
[ARIES-788] Possible NPE when destroying the blueprint container

Modified:
    aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/ReferenceListRecipe.java

Modified: aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/ReferenceListRecipe.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/ReferenceListRecipe.java?rev=1204935&r1=1204934&r2=1204935&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/ReferenceListRecipe.java
(original)
+++ aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/ReferenceListRecipe.java
Tue Nov 22 11:46:09 2011
@@ -184,10 +184,17 @@ public class ReferenceListRecipe extends
 
         public synchronized void destroy() {
             if (reference != null) {
-                reference.getBundle().getBundleContext().ungetService(reference);
+                ServiceReference ref = reference;
                 reference = null;
                 service = null;
                 proxy = null;
+                Bundle bundle = ref.getBundle();
+                if (bundle != null) {
+                    BundleContext ctx = bundle.getBundleContext();
+                    if (ctx != null) {
+                        ctx.ungetService(reference);
+                    }
+                }
             }
         }
 



Mime
View raw message