Author: markt
Date: Mon Sep 14 09:27:05 2015
New Revision: 1702881

URL: http://svn.apache.org/r1702881
Log:
Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=58369
Fix a rare data race in the code that obtains the CookieProcessor instance for 
the Context.

Modified:
    tomcat/trunk/java/org/apache/catalina/Context.java
    tomcat/trunk/java/org/apache/catalina/core/LocalStrings.properties
    tomcat/trunk/java/org/apache/catalina/core/StandardContext.java

Modified: tomcat/trunk/java/org/apache/catalina/Context.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/Context.java?rev=1702881&r1=1702880&r2=1702881&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/Context.java (original)
+++ tomcat/trunk/java/org/apache/catalina/Context.java Mon Sep 14 09:27:05 2015
@@ -1669,6 +1669,9 @@ public interface Context extends Contain
      * for this Context.
      *
      * @param cookieProcessor   The new cookie processor
+     *
+     * @throws IllegalArgumentException If a {@code null} CookieProcessor is
+     *         specified
      */
     public void setCookieProcessor(CookieProcessor cookieProcessor);
 

Modified: tomcat/trunk/java/org/apache/catalina/core/LocalStrings.properties
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/LocalStrings.properties?rev=1702881&r1=1702880&r2=1702881&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/LocalStrings.properties 
(original)
+++ tomcat/trunk/java/org/apache/catalina/core/LocalStrings.properties Mon Sep 
14 09:27:05 2015
@@ -110,6 +110,7 @@ standardContext.backgroundProcess.manage
 standardContext.backgroundProcess.resources=Exception processing resources {0} 
background process
 standardContext.cluster.noManager=No manager found. Checking if cluster 
manager should be used. Cluster configured: [{0}], Application distributable: 
[{1}]
 standardContext.configurationFail=One or more components marked the context as 
not correctly configured
+standardContext.cookieProcessor.null=It is not permitted to set the 
CookieProcessor for a Context to null
 standardContext.duplicateListener=The listener "{0}" is already configured for 
this context. The duplicate definition has been ignored.
 standardContext.errorPage.error=Error page location {0} must start with a ''/''
 standardContext.errorPage.required=ErrorPage cannot be null

Modified: tomcat/trunk/java/org/apache/catalina/core/StandardContext.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/StandardContext.java?rev=1702881&r1=1702880&r2=1702881&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/StandardContext.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/StandardContext.java Mon Sep 14 
09:27:05 2015
@@ -818,15 +818,16 @@ public class StandardContext extends Con
 
     @Override
     public void setCookieProcessor(CookieProcessor cookieProcessor) {
+        if (cookieProcessor == null) {
+            throw new IllegalArgumentException(
+                    sm.getString("standardContext.cookieProcessor.null"));
+        }
         this.cookieProcessor = cookieProcessor;
     }
 
 
     @Override
     public CookieProcessor getCookieProcessor() {
-        if (cookieProcessor == null) {
-            cookieProcessor = new LegacyCookieProcessor();
-        }
         return cookieProcessor;
     }
 
@@ -4978,6 +4979,11 @@ public class StandardContext extends Con
             setLoader(webappLoader);
         }
 
+        // An explicit cookie processor hasn't been specified; use the default
+        if (cookieProcessor == null) {
+            cookieProcessor = new LegacyCookieProcessor();
+        }
+
         // Initialize character set mapper
         getCharsetMapper();
 



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

Reply via email to