You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2011/10/20 21:57:15 UTC
svn commit: r1187027 -
/tomcat/trunk/java/org/apache/catalina/valves/RequestFilterValve.java
Author: markt
Date: Thu Oct 20 19:57:15 2011
New Revision: 1187027
URL: http://svn.apache.org/viewvc?rev=1187027&view=rev
Log:
Thread safety
Modified:
tomcat/trunk/java/org/apache/catalina/valves/RequestFilterValve.java
Modified: tomcat/trunk/java/org/apache/catalina/valves/RequestFilterValve.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/valves/RequestFilterValve.java?rev=1187027&r1=1187026&r2=1187027&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/valves/RequestFilterValve.java (original)
+++ tomcat/trunk/java/org/apache/catalina/valves/RequestFilterValve.java Thu Oct 20 19:57:15 2011
@@ -80,13 +80,13 @@ public abstract class RequestFilterValve
/**
* The regular expression used to test for allowed requests.
*/
- protected Pattern allow = null;
+ protected volatile Pattern allow = null;
/**
* The regular expression used to test for denied requests.
*/
- protected Pattern deny = null;
+ protected volatile Pattern deny = null;
// ------------------------------------------------------------- Properties
@@ -97,6 +97,8 @@ public abstract class RequestFilterValve
* Valve, if any; otherwise, return <code>null</code>.
*/
public String getAllow() {
+ // Use local copies for thread safety
+ Pattern allow = this.allow;
if (allow == null) {
return null;
}
@@ -124,6 +126,8 @@ public abstract class RequestFilterValve
* Valve, if any; otherwise, return <code>null</code>.
*/
public String getDeny() {
+ // Use local copies for thread safety
+ Pattern deny = this.deny;
if (deny == null) {
return null;
}
@@ -195,6 +199,10 @@ public abstract class RequestFilterValve
Request request, Response response)
throws IOException, ServletException {
+ // Use local copies for thread safety
+ Pattern deny = this.deny;
+ Pattern allow = this.allow;
+
// Check the deny patterns, if any
if (deny != null && deny.matcher(property).matches()) {
response.sendError(HttpServletResponse.SC_FORBIDDEN);
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org