Commits

Anonymous committed a4f1296

XW-679,WW-2507:
- fix I18nInterceptor dismisses browser provided locale
- backported WW-2507, missing synchronization
- minor refactorings to minimize synchronized block

git-svn-id: http://svn.opensymphony.com/svn/xwork/branches/2.0@1935e221344d-f017-0410-9bd5-d282ab1896d7

  • Participants
  • Parent commits 9d9e8c7
  • Branches 2.0

Comments (0)

Files changed (2)

File src/test/com/opensymphony/xwork2/interceptor/I18nInterceptorTest.java

         assertEquals(Locale.CHINA, session.get("hello"));
     }
 
+    public void testActionContextLocaleIsPreservedWhenNotOverridden() throws Exception {
+        final Locale locale1 = Locale.TRADITIONAL_CHINESE;
+        mai.getInvocationContext().setLocale(locale1);
+        interceptor.intercept(mai);
+
+        Locale locale = (Locale) session.get(I18nInterceptor.DEFAULT_SESSION_ATTRIBUTE);
+        assertNotNull(locale); // should be stored here
+        assertEquals(locale1, locale);
+    }
+
     protected void setUp() throws Exception {
         interceptor = new I18nInterceptor();
         interceptor.init();

File src/test/com/opensymphony/xwork2/interceptor/ParametersInterceptorTest.java

         params.put("\\u0023session.user2", "0wn3d");
         params.put("('\u0023'%20%2b%20'session[\'user3\']')(unused)", "0wn3d");
         params.put("('\\u0023' + 'session[\\'user4\\']')(unused)", "0wn3d");
+        params.put("\\u0023session[\'user5\']", "0wn3d");
+        params.put("\\u0023session.user6", "0wn3d");
 
         HashMap extraContext = new HashMap();
         extraContext.put(ActionContext.PARAMETERS, params);
         assertNull(session.get("user2"));
         assertNull(session.get("user3"));
         assertNull(session.get("user4"));
+        assertNull(session.get("user5"));
+        assertNull(session.get("user6"));
     }
 
     public void testParameters() throws Exception {
 
     public void testExcludedParametersAreIgnored() throws Exception {
         ParametersInterceptor pi = new ParametersInterceptor();
-        pi.setExcludeParams("dojo\\..*");
+        pi.setExcludeParams("dojo\\..*,.*\\\\.*");
         final Map actual = new HashMap();
         final ValueStack stack = new OgnlValueStack() {
             public void setValue(String expr, Object value) {
             {
                 put("dojo.test", "dojoValue");
                 put("fooKey", "fooValue");
+                put("bar\\Key", "barValue");
             }
         };
         pi.setParameters(new NoParametersAction(), stack, parameters);