Anonymous avatar Anonymous committed 6dd3cca

Solved issue XW-714 - if no locale found in session and no locale specified in request parameters, use locale from browser

git-svn-id: e221344d-f017-0410-9bd5-d282ab1896d7

Comments (0)

Files changed (2)


                         if (locale != null && LOG.isDebugEnabled()) {
                             LOG.debug("applied invocation context locale=" + locale);
+                        storeInSession = false;
                 if (storeInSession) {


 import com.opensymphony.xwork2.Action;
 import com.opensymphony.xwork2.ActionContext;
 import com.opensymphony.xwork2.SimpleFooAction;
+import com.opensymphony.xwork2.ActionInvocation;
 import com.opensymphony.xwork2.mock.MockActionInvocation;
 import junit.framework.TestCase;
 import java.util.HashMap;
 import java.util.Locale;
 import java.util.Map;
  * Unit test for I18nInterceptor.
     private I18nInterceptor interceptor;
     private ActionContext ac;
-    private Map params;
+    private Map<String, Serializable> params;
     private Map session;
-    private MockActionInvocation mai;
+    private ActionInvocation mai;
     public void testEmptyParamAndSession() throws Exception {
         Locale locale = (Locale) session.get(I18nInterceptor.DEFAULT_SESSION_ATTRIBUTE);
-        assertNotNull(locale); // should be stored here
+        assertNull(locale); // should not be stored here
+        locale = mai.getInvocationContext().getLocale();
         assertEquals(locale1, locale);
     protected void setUp() throws Exception {
         interceptor = new I18nInterceptor();
-        params = new HashMap();
+        params = new HashMap<String, Serializable>();
         session = new HashMap();
-        Map ctx = new HashMap();
+        Map<String, Object> ctx = new HashMap<String, Object>();
         ctx.put(ActionContext.PARAMETERS, params);
         ctx.put(ActionContext.SESSION, session);
         ac = new ActionContext(ctx);
         Action action = new SimpleFooAction();
         mai = new MockActionInvocation();
-        mai.setAction(action);
-        mai.setInvocationContext(ac);
+        ((MockActionInvocation) mai).setAction(action);
+        ((MockActionInvocation) mai).setInvocationContext(ac);
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.