Author: markt Date: Sun Sep 13 20:36:40 2015 New Revision: 1702821 URL: http://svn.apache.org/r1702821 Log: Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=58367 Fix a rare data race in the code the obtains the reason phrase for a given HTTP response code. Benchmarking shows no measurable performance difference.
Modified: tomcat/tc8.0.x/trunk/java/org/apache/tomcat/util/http/HttpMessages.java tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml Modified: tomcat/tc8.0.x/trunk/java/org/apache/tomcat/util/http/HttpMessages.java URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/java/org/apache/tomcat/util/http/HttpMessages.java?rev=1702821&r1=1702820&r2=1702821&view=diff ============================================================================== --- tomcat/tc8.0.x/trunk/java/org/apache/tomcat/util/http/HttpMessages.java (original) +++ tomcat/tc8.0.x/trunk/java/org/apache/tomcat/util/http/HttpMessages.java Sun Sep 13 20:36:40 2015 @@ -69,26 +69,34 @@ public class HttpMessages { // Does HTTP requires/allow international messages or // are pre-defined? The user doesn't see them most of the time switch( status ) { - case 200: - if(st_200 == null ) { - st_200 = sm.getString("sc.200"); + case 200: { + String s = st_200; + if(s == null ) { + st_200 = s = sm.getString("sc.200"); } - return st_200; - case 302: - if(st_302 == null ) { - st_302 = sm.getString("sc.302"); + return s; + } + case 302: { + String s = st_302; + if(s == null ) { + st_302 = s = sm.getString("sc.302"); } - return st_302; - case 400: - if(st_400 == null ) { - st_400 = sm.getString("sc.400"); + return s; + } + case 400: { + String s = st_400; + if(s == null ) { + st_400 = s = sm.getString("sc.400"); } - return st_400; - case 404: - if(st_404 == null ) { - st_404 = sm.getString("sc.404"); + return s; + } + case 404: { + String s = st_404; + if(s == null ) { + st_404 = s = sm.getString("sc.404"); } - return st_404; + return s; + } } return sm.getString("sc."+ status); } Modified: tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml?rev=1702821&r1=1702820&r2=1702821&view=diff ============================================================================== --- tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml (original) +++ tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml Sun Sep 13 20:36:40 2015 @@ -92,6 +92,10 @@ Minor clean-up in NIO2 SSL handshake code to address some theoretical concurrency issues. (markt) </scode> + <fix> + <bug>58367</bug>: Fix a rare data race in the code the obtains the + reason phrase for a given HTTP response code. (markt) + </fix> </changelog> </subsection> <subsection name="Jasper"> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org