WW-4250 Uses proper character set for Chinese

This commit is contained in:
Lukasz Lenart
2014-03-27 18:31:30 +01:00
parent 8b845ec814
commit 94e20fefcd
2 changed files with 14 additions and 1 deletions
@@ -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;
@@ -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);