servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jans...@apache.org
Subject svn commit: r1441026 - /servicemix/smx4/nmr/trunk/nmr/core/src/main/java/org/apache/servicemix/nmr/core/security/DefaultAuthorizationService.java
Date Thu, 31 Jan 2013 15:53:07 GMT
Author: janstey
Date: Thu Jan 31 15:53:07 2013
New Revision: 1441026

URL: http://svn.apache.org/viewvc?rev=1441026&view=rev
Log:
SMX4NMR-307 - org.apache.servicemix.nmr.osgi can throw an exception when shutting down

Modified:
    servicemix/smx4/nmr/trunk/nmr/core/src/main/java/org/apache/servicemix/nmr/core/security/DefaultAuthorizationService.java

Modified: servicemix/smx4/nmr/trunk/nmr/core/src/main/java/org/apache/servicemix/nmr/core/security/DefaultAuthorizationService.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/nmr/core/src/main/java/org/apache/servicemix/nmr/core/security/DefaultAuthorizationService.java?rev=1441026&r1=1441025&r2=1441026&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/nmr/core/src/main/java/org/apache/servicemix/nmr/core/security/DefaultAuthorizationService.java
(original)
+++ servicemix/smx4/nmr/trunk/nmr/core/src/main/java/org/apache/servicemix/nmr/core/security/DefaultAuthorizationService.java
Thu Jan 31 15:53:07 2013
@@ -24,7 +24,6 @@ import java.util.Collections;
 import java.util.Comparator;
 import java.util.Map;
 import java.util.StringTokenizer;
-import java.util.WeakHashMap;
 import java.util.regex.Pattern;
 
 import javax.xml.namespace.QName;
@@ -32,12 +31,16 @@ import javax.xml.namespace.QName;
 import org.apache.servicemix.nmr.api.security.AuthorizationService;
 import org.apache.servicemix.nmr.api.security.GroupPrincipal;
 import org.apache.servicemix.nmr.api.security.AuthorizationEntry;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * A default implementation of the authorization service.
  */
 public class DefaultAuthorizationService implements AuthorizationService {
 
+    private final Logger logger = LoggerFactory.getLogger(DefaultAuthorizationService.class);
+    
     private List<AuthorizationEntry> authorizationEntries;
     private Comparator<AuthorizationEntry> comparator;
     private Map<String, Set<GroupPrincipal>> cache;
@@ -65,7 +68,13 @@ public class DefaultAuthorizationService
     }
 
     public void unregister(AuthorizationEntry entry, Map<String,?> props) {
-        authorizationEntries.remove(entry);
+        try {
+            authorizationEntries.remove(entry);
+        } catch (Exception e) {
+            // blueprint can throw an exception here if the service representing 
+            // this AuthorizationEntry is already shutdown
+            logger.debug("Exception occurred while unregistering AuthorizationEntry service.",
e);
+        }
         Collections.sort(authorizationEntries, comparator);
         cache.clear();
     }



Mime
View raw message