Author: ate
Date: Fri May 13 15:46:47 2011
New Revision: 1102798

URL: http://svn.apache.org/viewvc?rev=1102798&view=rev
Log:
JS2-1183: ensure CurrentLocale ThreadLocal reset after (request) usage

Modified:
    
portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/localization/impl/LocalizationValveImpl.java
    
portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/localization/impl/SimplifiedLocalizationValveImpl.java

Modified: 
portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/localization/impl/LocalizationValveImpl.java
URL: 
http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/localization/impl/LocalizationValveImpl.java?rev=1102798&r1=1102797&r2=1102798&view=diff
==============================================================================
--- 
portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/localization/impl/LocalizationValveImpl.java
 (original)
+++ 
portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/localization/impl/LocalizationValveImpl.java
 Fri May 13 15:46:47 2011
@@ -167,8 +167,15 @@ public class LocalizationValveImpl exten
         
request.getRequest().getSession().setAttribute(PortalReservedParameters.PREFERED_LOCALE_ATTRIBUTE,
 locale);
         CurrentLocale.set(locale);
         // Pass control to the next Valve in the Pipeline
-        context.invokeNext(request);
-
+        try
+        {
+            context.invokeNext(request);
+        }
+        finally
+        {
+            // ensure clearing of ThreadLocal state after request
+            CurrentLocale.set(null);
+        }
     }
 
     public String toString()

Modified: 
portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/localization/impl/SimplifiedLocalizationValveImpl.java
URL: 
http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/localization/impl/SimplifiedLocalizationValveImpl.java?rev=1102798&r1=1102797&r2=1102798&view=diff
==============================================================================
--- 
portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/localization/impl/SimplifiedLocalizationValveImpl.java
 (original)
+++ 
portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/localization/impl/SimplifiedLocalizationValveImpl.java
 Fri May 13 15:46:47 2011
@@ -119,8 +119,15 @@ public class SimplifiedLocalizationValve
         CurrentLocale.set(locale);
        
         // Pass control to the next Valve in the Pipeline
-        context.invokeNext(request);
-
+        try
+        {
+            context.invokeNext(request);
+        }
+        finally
+        {
+            // ensure clearing of ThreadLocal state after request
+            CurrentLocale.set(null);
+        }
     }
 
     public String toString()



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

Reply via email to