You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by lu...@apache.org on 2014/03/27 18:31:46 UTC

[1/2] git commit: WW-4250 extends ParametersInterceptor to support chinese in hash key

Repository: struts
Updated Branches:
  refs/heads/develop e62547e04 -> 94e20fefc


WW-4250 extends ParametersInterceptor to support chinese in hash key


Project: http://git-wip-us.apache.org/repos/asf/struts/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/8b845ec8
Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/8b845ec8
Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/8b845ec8

Branch: refs/heads/develop
Commit: 8b845ec814a428121617a8bea387a34fed74dcf5
Parents: e62547e
Author: Lukasz Lenart <lu...@apache.org>
Authored: Thu Mar 27 07:03:52 2014 +0100
Committer: Lukasz Lenart <lu...@apache.org>
Committed: Thu Mar 27 07:03:52 2014 +0100

----------------------------------------------------------------------
 .../com/opensymphony/xwork2/interceptor/ParametersInterceptor.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/8b845ec8/xwork-core/src/main/java/com/opensymphony/xwork2/interceptor/ParametersInterceptor.java
----------------------------------------------------------------------
diff --git a/xwork-core/src/main/java/com/opensymphony/xwork2/interceptor/ParametersInterceptor.java b/xwork-core/src/main/java/com/opensymphony/xwork2/interceptor/ParametersInterceptor.java
index 75911a8..7f3f677 100644
--- a/xwork-core/src/main/java/com/opensymphony/xwork2/interceptor/ParametersInterceptor.java
+++ b/xwork-core/src/main/java/com/opensymphony/xwork2/interceptor/ParametersInterceptor.java
@@ -141,7 +141,7 @@ public class ParametersInterceptor extends MethodFilterInterceptor {
 
     private static final Logger LOG = LoggerFactory.getLogger(ParametersInterceptor.class);
 
-    public static final String ACCEPTED_PARAM_NAMES = "\\w+((\\.\\w+)|(\\[\\d+\\])|(\\(\\d+\\))|(\\['\\w+'\\])|(\\('\\w+'\\)))*";
+    public static final String ACCEPTED_PARAM_NAMES = "\\w+((\\.\\w+)|(\\[\\d+\\])|(\\(\\d+\\))|(\\['(\\w|[^x00-xff])+'\\])|(\\('(\\w|[^x00-xff])+'\\)))*";
 
     protected static final int PARAM_NAME_MAX_LENGTH = 100;
 


[2/2] git commit: WW-4250 Uses proper character set for Chinese

Posted by lu...@apache.org.
WW-4250 Uses proper character set for Chinese


Project: http://git-wip-us.apache.org/repos/asf/struts/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/94e20fef
Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/94e20fef
Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/94e20fef

Branch: refs/heads/develop
Commit: 94e20fefcd624282ad6425da750fdd1e289f6436
Parents: 8b845ec
Author: Lukasz Lenart <lu...@apache.org>
Authored: Thu Mar 27 18:31:30 2014 +0100
Committer: Lukasz Lenart <lu...@apache.org>
Committed: Thu Mar 27 18:31:30 2014 +0100

----------------------------------------------------------------------
 .../xwork2/interceptor/ParametersInterceptor.java      |  2 +-
 .../xwork2/interceptor/ParametersInterceptorTest.java  | 13 +++++++++++++
 2 files changed, 14 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/94e20fef/xwork-core/src/main/java/com/opensymphony/xwork2/interceptor/ParametersInterceptor.java
----------------------------------------------------------------------
diff --git a/xwork-core/src/main/java/com/opensymphony/xwork2/interceptor/ParametersInterceptor.java b/xwork-core/src/main/java/com/opensymphony/xwork2/interceptor/ParametersInterceptor.java
index 7f3f677..cb38d57 100644
--- a/xwork-core/src/main/java/com/opensymphony/xwork2/interceptor/ParametersInterceptor.java
+++ b/xwork-core/src/main/java/com/opensymphony/xwork2/interceptor/ParametersInterceptor.java
@@ -141,7 +141,7 @@ public class ParametersInterceptor extends MethodFilterInterceptor {
 
     private static final Logger LOG = LoggerFactory.getLogger(ParametersInterceptor.class);
 
-    public static final String ACCEPTED_PARAM_NAMES = "\\w+((\\.\\w+)|(\\[\\d+\\])|(\\(\\d+\\))|(\\['(\\w|[^x00-xff])+'\\])|(\\('(\\w|[^x00-xff])+'\\)))*";
+    public static final String ACCEPTED_PARAM_NAMES = "\\w+((\\.\\w+)|(\\[\\d+\\])|(\\(\\d+\\))|(\\['(\\w|[\\u4e00-\\u9fa5])+'\\])|(\\('(\\w|[\\u4e00-\\u9fa5])+'\\)))*";
 
     protected static final int PARAM_NAME_MAX_LENGTH = 100;
 

http://git-wip-us.apache.org/repos/asf/struts/blob/94e20fef/xwork-core/src/test/java/com/opensymphony/xwork2/interceptor/ParametersInterceptorTest.java
----------------------------------------------------------------------
diff --git a/xwork-core/src/test/java/com/opensymphony/xwork2/interceptor/ParametersInterceptorTest.java b/xwork-core/src/test/java/com/opensymphony/xwork2/interceptor/ParametersInterceptorTest.java
index e616fb8..50eeb4f 100644
--- a/xwork-core/src/test/java/com/opensymphony/xwork2/interceptor/ParametersInterceptorTest.java
+++ b/xwork-core/src/test/java/com/opensymphony/xwork2/interceptor/ParametersInterceptorTest.java
@@ -237,6 +237,19 @@ public class ParametersInterceptorTest extends XWorkTestCase {
         assertEquals(0, existingMap.size());
     }
 
+    public void testParametersWithChineseInTheName() throws Exception {
+        Map<String, Object> params = new HashMap<String, Object>();
+        params.put("theProtectedMap['名字']", "test1");
+
+        HashMap<String, Object> extraContext = new HashMap<String, Object>();
+        extraContext.put(ActionContext.PARAMETERS, params);
+
+        ActionProxy proxy = actionProxyFactory.createActionProxy("", MockConfigurationProvider.PARAM_INTERCEPTOR_ACTION_NAME, null, extraContext);
+        proxy.execute();
+        Map<String, String> existingMap = ((SimpleAction) proxy.getAction()).getTheProtectedMap();
+        assertEquals(1, existingMap.size());
+    }
+
     public void testLargeParameterNameWithDefaultLimit() throws Exception {
         ParametersInterceptor parametersInterceptor = createParametersInterceptor();
         doTestParameterNameLengthRestriction(parametersInterceptor, ParametersInterceptor.PARAM_NAME_MAX_LENGTH);