[jboss-cvs] JBossAS SVN: r103364 - projects/security/security-jboss-sx/branches/Branch_2_0/jbosssx/src/main/java/org/jboss/security/plugins.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Mar 31 18:07:24 EDT 2010


Author: anil.saldhana at jboss.com
Date: 2010-03-31 18:07:24 -0400 (Wed, 31 Mar 2010)
New Revision: 103364

Modified:
   projects/security/security-jboss-sx/branches/Branch_2_0/jbosssx/src/main/java/org/jboss/security/plugins/JBossAuthorizationManager.java
Log:
SECURITY-490: remove the redundant lock

Modified: projects/security/security-jboss-sx/branches/Branch_2_0/jbosssx/src/main/java/org/jboss/security/plugins/JBossAuthorizationManager.java
===================================================================
--- projects/security/security-jboss-sx/branches/Branch_2_0/jbosssx/src/main/java/org/jboss/security/plugins/JBossAuthorizationManager.java	2010-03-31 21:05:10 UTC (rev 103363)
+++ projects/security/security-jboss-sx/branches/Branch_2_0/jbosssx/src/main/java/org/jboss/security/plugins/JBossAuthorizationManager.java	2010-03-31 22:07:24 UTC (rev 103364)
@@ -279,12 +279,13 @@
       if(ac == null)
          throw new IllegalArgumentException("AuthorizationContext is null");
       lock.lock();
+
+      String sc = ac.getSecurityDomain();
+      if(this.securityDomain.equals(sc) == false)
+         throw new IllegalArgumentException("The Security Domain "+ sc 
+               + " does not match with " + this.securityDomain);
       try
-      {  
-         String sc = ac.getSecurityDomain();
-         if(this.securityDomain.equals(sc) == false)
-            throw new IllegalArgumentException("The Security Domain "+ sc 
-                  + " does not match with " + this.securityDomain);
+      { 
          this.authorizationContext = ac;  
       }
       finally
@@ -467,17 +468,9 @@
          RoleGroup role)
    throws AuthorizationException
    {
-      lock.lock();
-      try
-      {
-         if(this.authorizationContext == null)
-            this.authorizationContext = new JBossAuthorizationContext(this.securityDomain);
-         return this.authorizationContext.authorize(resource, subject, role); 
-      }
-      finally
-      {
-         lock.unlock();
-      } 
+      if(this.authorizationContext == null)
+         this.setAuthorizationContext( new JBossAuthorizationContext(this.securityDomain) );
+      return this.authorizationContext.authorize(resource, subject, role); 
    }
    
    /**




More information about the jboss-cvs-commits mailing list