You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by sm...@apache.org on 2015/05/21 16:28:53 UTC

directory-fortress-realm git commit: FC-105 - [fortress-realm] - redundant null check, write to static field, catch throwable

Repository: directory-fortress-realm
Updated Branches:
  refs/heads/master 85fe43793 -> 1fc01cc04


FC-105 - [fortress-realm] - redundant null check, write to static field, catch throwable


Project: http://git-wip-us.apache.org/repos/asf/directory-fortress-realm/repo
Commit: http://git-wip-us.apache.org/repos/asf/directory-fortress-realm/commit/1fc01cc0
Tree: http://git-wip-us.apache.org/repos/asf/directory-fortress-realm/tree/1fc01cc0
Diff: http://git-wip-us.apache.org/repos/asf/directory-fortress-realm/diff/1fc01cc0

Branch: refs/heads/master
Commit: 1fc01cc04cbcd6f49758c5f3a046051adb9a2e75
Parents: 85fe437
Author: Shawn McKinney <sm...@apache.org>
Authored: Thu May 21 09:28:46 2015 -0500
Committer: Shawn McKinney <sm...@apache.org>
Committed: Thu May 21 09:28:46 2015 -0500

----------------------------------------------------------------------
 .../realm/tomcat/Tc7AccessMgrProxy.java         | 30 ++++++--------------
 1 file changed, 9 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-fortress-realm/blob/1fc01cc0/proxy/src/main/java/org/apache/directory/fortress/realm/tomcat/Tc7AccessMgrProxy.java
----------------------------------------------------------------------
diff --git a/proxy/src/main/java/org/apache/directory/fortress/realm/tomcat/Tc7AccessMgrProxy.java b/proxy/src/main/java/org/apache/directory/fortress/realm/tomcat/Tc7AccessMgrProxy.java
index 5b9e10e..8f514db 100644
--- a/proxy/src/main/java/org/apache/directory/fortress/realm/tomcat/Tc7AccessMgrProxy.java
+++ b/proxy/src/main/java/org/apache/directory/fortress/realm/tomcat/Tc7AccessMgrProxy.java
@@ -36,7 +36,7 @@ import org.apache.directory.fortress.realm.util.ChildFirstUrlClassLoader;
  * This class is a "proxy" for the {@link org.apache.directory.fortress.realm.tomcat.TcAccessMgrImpl} class which isolates dependencies from the Tomcat
  * runtime environment by loading the implementation on a URLClassLoader.
  *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</ga>
  */
 public class Tc7AccessMgrProxy extends RealmBase
 {
@@ -45,8 +45,8 @@ public class Tc7AccessMgrProxy extends RealmBase
     private static final String REALM_IMPL = "org.apache.directory.fortress.realm.tomcat.TcAccessMgrImpl";
     private static final String REALM_CLASSPATH = "REALM_CLASSPATH";
     private static final String JBOSS_AGENT = "jboss";
-    private static String CONTAINER = "Catalina7";
-    private static String defaultRoles;
+    private String CONTAINER = "Catalina7";
+    private String defaultRoles;
     private String realmClasspath;
     private TcAccessMgr realm;
 
@@ -64,17 +64,7 @@ public class Tc7AccessMgrProxy extends RealmBase
             {
                 LOG.info( CLS_NM + ".initialize JBoss policy agent" );
                 URL[] cp = CpUtil.getRealmClasspath( REALM_CLASSPATH );
-                
-                if ( cp != null )
-                {
-                    ucl = new ChildFirstUrlClassLoader(cp, this.getClass().getClassLoader() );
-                }
-                else
-                {
-                    String error = CLS_NM + ".initialize invalid realm classpath setup";
-                    LOG.severe( error );
-                    throw new RuntimeException( error );
-                }
+                ucl = new ChildFirstUrlClassLoader(cp, this.getClass().getClassLoader() );
             }
             else if ( CONTAINER.equalsIgnoreCase( "TomcatContext" ) )
             {
@@ -238,9 +228,9 @@ public class Tc7AccessMgrProxy extends RealmBase
         {
             initialize();
         }
-        catch (Throwable e)
+        catch (Exception e)
         {
-            String error = CLS_NM + ".startInternal caught Throwable=" + e;
+            String error = CLS_NM + ".startInternal caught Exception=" + e;
             LOG.severe( error );
             e.printStackTrace();
             throw new LifecycleException( error );
@@ -302,7 +292,6 @@ public class Tc7AccessMgrProxy extends RealmBase
     public String getRealmClasspath()
     {
         LOG.info( CLS_NM + ".getRealmClasspath <" + realmClasspath + ">" );
-        
         return realmClasspath;
     }
 
@@ -324,10 +313,9 @@ public class Tc7AccessMgrProxy extends RealmBase
      *
      * @return String containing comma delimited list of role names.
      */
-    public static String getDefaultRoles()
+    public String getDefaultRoles()
     {
         LOG.info( CLS_NM + ".getDefaultRoles <" + defaultRoles + ">" );
-        
         return defaultRoles;
     }
 
@@ -337,9 +325,9 @@ public class Tc7AccessMgrProxy extends RealmBase
      *
      * @param defaultRoles containing comma delimited list of role names.
      */
-    public static void setDefaultRoles( String defaultRoles )
+    public void setDefaultRoles( String defaultRoles )
     {
         LOG.info( CLS_NM + ".setDefaultRoles <" + defaultRoles + ">" );
-        Tc7AccessMgrProxy.defaultRoles = defaultRoles;
+        this.defaultRoles = defaultRoles;
     }
 }
\ No newline at end of file