This is an automated email from the ASF dual-hosted git repository. yasserzamani pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/struts.git
commit a16cd4fca62e5df43b9afb045443f6e581d4a41e Author: Yasser Zamani <yasserzam...@apache.org> AuthorDate: Sat Jun 1 09:37:19 2019 +0430 test not throw exception on top missing property (WW-4999) instead continue to next objects in stack Also tests not skip returned null values by user method (cherry picked from commit d4dd338) --- .../xwork2/ognl/OgnlValueStackTest.java | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/core/src/test/java/com/opensymphony/xwork2/ognl/OgnlValueStackTest.java b/core/src/test/java/com/opensymphony/xwork2/ognl/OgnlValueStackTest.java index 52b850f..e4b13a0 100644 --- a/core/src/test/java/com/opensymphony/xwork2/ognl/OgnlValueStackTest.java +++ b/core/src/test/java/com/opensymphony/xwork2/ognl/OgnlValueStackTest.java @@ -963,6 +963,33 @@ public class OgnlValueStackTest extends XWorkTestCase { assertNull(vs.findValue("@com.nothing.here.Nothing@BLAH")); } + /** + * Fails on 2.5.20 and earlier - tested on 2.5 (5/5/2016) and failed + * @since 2.5.21 + */ + public void testNotThrowExceptionOnTopMissingProperty() { + OgnlValueStack vs = createValueStack(); + + Dog dog = new Dog(); + dog.setName("Rover"); + vs.push(dog); + + Cat cat = new Cat(); + vs.push(cat); + + vs.setValue("age", 12, true); + + assertEquals(12, vs.findValue("age", true)); + assertEquals(12, vs.findValue("age", Integer.class, true)); + assertEquals(12, vs.findValue("getAge()", true)); + assertEquals(12, vs.findValue("getAge()", Integer.class, true)); + + assertNull(vs.findValue("name", true)); + assertNull(vs.findValue("name", String.class, true)); + assertNull(vs.findValue("getName()", true)); + assertNull(vs.findValue("getName()", String.class, true)); + } + public void testTop() { OgnlValueStack vs = createValueStack();