Commits

jcarreira  committed 3f16179

Adding another log for not finding property in OgnlValueStack and adding another type conversion error test.

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

  • Participants
  • Parent commits 2744c44

Comments (0)

Files changed (2)

File src/java/com/opensymphony/xwork/util/CompoundRootAccessor.java

 
         Boolean reportError = (Boolean) context.get(OgnlValueStack.REPORT_ERRORS_ON_NO_PROP);
 
+        final String msg = "No object in the CompoundRoot has a property named '" + name + "'.";
         if ((reportError != null) && (reportError.booleanValue())) {
-            final String msg = "No object in the CompoundRoot has a property named '" + name + "'.";
             log.error(msg);
             throw new RuntimeException(msg);
+        } else {
+            log.info(msg);
         }
     }
 

File src/test/com/opensymphony/xwork/util/OgnlValueStackTest.java

 
 import com.opensymphony.xwork.ActionContext;
 import com.opensymphony.xwork.SimpleAction;
+import com.opensymphony.xwork.TestBean;
 
 import junit.framework.TestCase;
 
         assertEquals(0, action.getBar());
     }
 
+    public void testTypeConversionError() {
+        TestBean bean = new TestBean();
+        OgnlValueStack stack = new OgnlValueStack();
+        stack.push(bean);
+        stack.getContext().put(XWorkConverter.REPORT_CONVERSION_ERRORS, Boolean.TRUE);
+        stack.setValue("count","a");
+        Map conversionErrors = (Map) stack.getContext().get(ActionContext.CONVERSION_ERRORS);
+        assertTrue(conversionErrors.containsKey("count"));
+    }
+
     public void testSerializable() throws IOException, ClassNotFoundException {
         OgnlValueStack vs = new OgnlValueStack();