Commits

Anonymous committed f5c8d0b

ConversionErrorInterceptor bug when propertyName contains single quotes
Issue number: XW-269
Obtained from:
Submitted by: Erik J�gi
Reviewed by: Rainer Hermanns

git-svn-id: http://svn.opensymphony.com/svn/xwork/trunk@808e221344d-f017-0410-9bd5-d282ab1896d7

Comments (0)

Files changed (1)

src/test/com/opensymphony/xwork/interceptor/ConversionErrorInterceptorTest.java

         SimpleAction action = new SimpleAction();
         mockInvocation.expectAndReturn("getAction", action);
         stack.push(action);
-        mockInvocation.matchAndReturn("getAction",action);
+        mockInvocation.matchAndReturn("getAction", action);
         assertNull(action.getFieldErrors().get("foo"));
         interceptor.intercept(invocation);
         assertTrue(action.hasFieldErrors());
         assertNotNull(action.getFieldErrors().get("foo"));
     }
 
+    public void testFieldErrorWithMapKeyAdded() throws Exception {
+        String fieldName = "foo['1'].intValue";
+        conversionErrors.put(fieldName, "bar");
+        ActionSupport action = new ActionSupport();
+        mockInvocation.expectAndReturn("getAction", action);
+        stack.push(action);
+        mockInvocation.matchAndReturn("getAction", action);
+        assertNull(action.getFieldErrors().get(fieldName));
+        interceptor.intercept(invocation);
+        assertTrue(action.hasFieldErrors()); // This fails!
+        assertNotNull(action.getFieldErrors().get(fieldName));
+    }
+
     protected void setUp() throws Exception {
         super.setUp();
         interceptor = new ConversionErrorInterceptor();