Author: markt
Date: Mon Jul 27 09:42:58 2015
New Revision: 1692849
URL: http://svn.apache.org/r1692849
Log:
Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=58179
Fix atomicity violation (concurrent requests could both see null as the old
value)
Modified:
tomcat/trunk/java/org/apache/catalina/core/ApplicationContext.java
Modified: tomcat/trunk/java/org/apache/catalina/core/ApplicationContext.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/ApplicationContext.java?rev=1692849&r1=1692848&r2=1692849&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/ApplicationContext.java
(original)
+++ tomcat/trunk/java/org/apache/catalina/core/ApplicationContext.java Mon Jul
27 09:42:58 2015
@@ -781,17 +781,13 @@ public class ApplicationContext
return;
}
- Object oldValue = null;
- boolean replaced = false;
-
// Add or replace the specified attribute
// Check for read only attribute
if (readOnlyAttributes.containsKey(name))
return;
- oldValue = attributes.get(name);
- if (oldValue != null)
- replaced = true;
- attributes.put(name, value);
+
+ Object oldValue = attributes.put(name, value);
+ boolean replaced = oldValue != null;
// Notify interested application event listeners
Object listeners[] = context.getApplicationEventListeners();
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]