tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1242947 - /tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java
Date Fri, 10 Feb 2012 21:48:09 GMT
Author: markt
Date: Fri Feb 10 21:48:08 2012
New Revision: 1242947

URL: http://svn.apache.org/viewvc?rev=1242947&view=rev
Log:
Fix threading issue in initialization of standard authenticator list

Modified:
    tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java

Modified: tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java?rev=1242947&r1=1242946&r2=1242947&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java Fri Feb 10 21:48:08 2012
@@ -131,7 +131,24 @@ public class ContextConfig implements Li
      * the name of the implemented authentication method, and the value is
      * the fully qualified Java class name of the corresponding Valve.
      */
-    protected static Properties authenticators = null;
+    protected static final Properties authenticators;
+
+    static {
+        // Load our mapping properties for the standard authenticators
+        InputStream is =
+                ContextConfig.class.getClassLoader().getResourceAsStream(
+                    "org/apache/catalina/startup/Authenticators.properties");
+        Properties props = null;
+        props = new Properties();
+        if (is != null) {
+            try {
+                props.load(is);
+            } catch (IOException e) {
+                props = null;
+            }
+        }
+        authenticators = props;
+    }
 
 
     /**
@@ -335,7 +352,7 @@ public class ContextConfig implements Li
      * Set up an Authenticator automatically if required, and one has not
      * already been configured.
      */
-    protected synchronized void authenticatorConfig() {
+    protected void authenticatorConfig() {
 
         LoginConfig loginConfig = context.getLoginConfig();
 
@@ -377,25 +394,10 @@ public class ContextConfig implements Li
                 customAuthenticators.get(loginConfig.getAuthMethod());
         }
         if (authenticator == null) {
-            // Load our mapping properties if necessary
             if (authenticators == null) {
-                try {
-                    InputStream is=this.getClass().getClassLoader().getResourceAsStream("org/apache/catalina/startup/Authenticators.properties");
-                    if( is!=null ) {
-                        authenticators = new Properties();
-                        authenticators.load(is);
-                    } else {
-                        log.error(sm.getString(
-                                "contextConfig.authenticatorResources"));
-                        ok=false;
-                        return;
-                    }
-                } catch (IOException e) {
-                    log.error(sm.getString(
-                                "contextConfig.authenticatorResources"), e);
-                    ok = false;
-                    return;
-                }
+                log.error(sm.getString("contextConfig.authenticatorResources"));
+                ok = false;
+                return;
             }
 
             // Identify the class name of the Valve we should configure



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message