Revision: 759
          http://stripes.svn.sourceforge.net/stripes/?rev=759&view=rev
Author:   tfenne
Date:     2008-01-18 13:10:22 -0800 (Fri, 18 Jan 2008)

Log Message:
-----------
Fix for problem that caused the PropertyExpressionEvaluation to fail in some 
cases when type information wasn't discernable from the static information and 
fall back to instance information should have taken place.

Modified Paths:
--------------
    
trunk/stripes/src/net/sourceforge/stripes/util/bean/PropertyExpressionEvaluation.java
    trunk/tests/src/net/sourceforge/stripes/test/TestBean.java
    
trunk/tests/src/net/sourceforge/stripes/util/bean/PropertyExpressionEvaluationTests.java

Modified: 
trunk/stripes/src/net/sourceforge/stripes/util/bean/PropertyExpressionEvaluation.java
===================================================================
--- 
trunk/stripes/src/net/sourceforge/stripes/util/bean/PropertyExpressionEvaluation.java
       2008-01-18 18:24:37 UTC (rev 758)
+++ 
trunk/stripes/src/net/sourceforge/stripes/util/bean/PropertyExpressionEvaluation.java
       2008-01-18 21:10:22 UTC (rev 759)
@@ -181,11 +181,13 @@
                     current.setValueType(type);
                     current.setType(NodeType.BeanProperty);
                 }
-                else {
-                    type = getTypeViaInstances(current);
-                    if (type == null) {
-                        // XXX What do we do now?
-                    }
+            }
+
+            // If we haven't gotten type information by now, try filling in 
with instance info
+            if (type == null) {
+                type = getTypeViaInstances(current);
+                if (type == null) {
+                    // FIXME: What do we do now?
                 }
             }
         }

Modified: trunk/tests/src/net/sourceforge/stripes/test/TestBean.java
===================================================================
--- trunk/tests/src/net/sourceforge/stripes/test/TestBean.java  2008-01-18 
18:24:37 UTC (rev 758)
+++ trunk/tests/src/net/sourceforge/stripes/test/TestBean.java  2008-01-18 
21:10:22 UTC (rev 759)
@@ -10,8 +10,7 @@
  *
  * @author Tim Fennell
  */
-public class
-        TestBean {
+public class TestBean {
     private String stringProperty;
     private int intProperty;
     private Long longProperty;

Modified: 
trunk/tests/src/net/sourceforge/stripes/util/bean/PropertyExpressionEvaluationTests.java
===================================================================
--- 
trunk/tests/src/net/sourceforge/stripes/util/bean/PropertyExpressionEvaluationTests.java
    2008-01-18 18:24:37 UTC (rev 758)
+++ 
trunk/tests/src/net/sourceforge/stripes/util/bean/PropertyExpressionEvaluationTests.java
    2008-01-18 21:10:22 UTC (rev 759)
@@ -283,4 +283,19 @@
         String value = (String) BeanUtil.getPropertyValue("value", entry);
         Assert.assertEquals(value, "value");
     }
+
+    /**
+     * Fix for a problem whereby in certain circumstances the 
PropertyExpressionEvaluation
+     * would not fall back to looking at instance information to figure out 
the type info.
+     */
+    @Test(groups="fast")
+    public void testFallBackToInstanceInfo() throws Exception {
+        Map<String,TestBean> map = new HashMap<String,TestBean>();
+        map.put("foo", new TestBean());
+        map.get("foo").setStringProperty("bar");
+        Map.Entry<String,TestBean> entry = map.entrySet().iterator().next();
+        String value = (String) 
BeanUtil.getPropertyValue("value.stringProperty", entry);
+        Assert.assertEquals(value, "bar");
+    }
+
 }


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development

Reply via email to