struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lukaszlen...@apache.org
Subject [2/2] git commit: WW-4250 Uses proper character set for Chinese
Date Thu, 27 Mar 2014 17:31:47 GMT
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 <lukaszlenart@apache.org>
Authored: Thu Mar 27 18:31:30 2014 +0100
Committer: Lukasz Lenart <lukaszlenart@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);


Mime
View raw message