Commits

musachy  committed 89730db

WW-3306 Null value accepted from action property, but not model property when throwExceptionOnFailure=true

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

  • Participants
  • Parent commits ea956db

Comments (0)

Files changed (2)

File core/src/main/java/com/opensymphony/xwork2/ognl/OgnlValueStack.java

             // find objects with Action in them and inspect matching getters
             Set<String> availableProperties = new LinkedHashSet<String>();
             for (Object o : root) {
-                if (o instanceof ActionSupport || o.getClass().getSimpleName().endsWith("Action")) {
-                    try {
-                        findAvailableProperties(o.getClass(), expr, availableProperties, null);
-                    } catch (IntrospectionException ise) {
-                        // ignore
-                    }
+                try {
+                    findAvailableProperties(o.getClass(), expr, availableProperties, null);
+                } catch (IntrospectionException ise) {
+                    // ignore
                 }
             }
             if (!availableProperties.contains(expr)) {

File core/src/test/java/com/opensymphony/xwork2/ognl/OgnlValueStackTest.java

         }
     }
 
+    public void testDoesNotFailOnNonActionObjects() {
+        //if a value is not found, then it will check for missing properties
+        //it needs to check in all objects in the stack, not only actions, see WW-3306
+        OgnlValueStack vs = createValueStack();
+
+        Dog dog = new Dog();
+        dog.setHates(null);
+        vs.push(dog);
+        vs.findValue("hates", true);
+    }
+
+
     public void testFailOnMissingNestedProperty() {
         OgnlValueStack vs = createValueStack();