Commits

Anonymous committed ca1c06b

Comments (0)

Files changed (2)

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

         for (Iterator iterator = root.iterator(); iterator.hasNext();) {
             Object o = iterator.next();
 
+            if (o == null) {
+                continue;
+            }
+
             try {
                 if (OgnlRuntime.hasSetProperty(ognlContext, o, name)) {
                     OgnlRuntime.setProperty(ognlContext, o, name, value);
             for (Iterator iterator = root.iterator(); iterator.hasNext();) {
                 Object o = iterator.next();
 
+                if (o == null) {
+                    continue;
+                }
+
                 try {
                     if ((OgnlRuntime.hasGetProperty(ognlContext, o, name)) || ((o instanceof Map) && ((Map) o).containsKey(name))) {
                         Object value = OgnlRuntime.getProperty(ognlContext, o, name);

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

         assertEquals(a_value, vs.findValue(a_key));
         assertEquals(b_value, vs.findValue(b_key));
     }
+
+    public void testNullEntry() {
+        OgnlValueStack vs = new OgnlValueStack();
+
+        Dog dog = new Dog();
+        dog.setName("Rover");
+
+        vs.push(dog);
+        assertEquals("Rover", vs.findValue("name", String.class));
+
+        vs.push(null);
+        assertEquals("Rover", vs.findValue("name", String.class));
+    }
+
 }
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.