PropertyModel does not support index only property ("[0]")
----------------------------------------------------------

                 Key: WICKET-2354
                 URL: https://issues.apache.org/jira/browse/WICKET-2354
             Project: Wicket
          Issue Type: Bug
          Components: wicket
    Affects Versions: 1.3.6
         Environment: Windows XP, Eclipse 1.3.6, Java 1.6.0.13, Wicket 1.3.6
            Reporter: Hielke Hoeve
            Priority: Minor


When using a PropertyModel with a list as target and an index ("[0]") as 
property the PropertyModel cannot retreive the object from the list. When 
getObject() is called a IndexOutOfBoundsException is thrown.

Example:
List addresses = new List();
new PropertyModel(addresses, "[0]");
model.getObject();

Exception:
java.lang.StringIndexOutOfBoundsException: String index out of range: 0
        at java.lang.String.charAt(String.java:687)
        at 
org.apache.wicket.util.lang.PropertyResolver.findGetter(PropertyResolver.java:509)
        at 
org.apache.wicket.util.lang.PropertyResolver.getGetAndSetter(PropertyResolver.java:338)
        at 
org.apache.wicket.util.lang.PropertyResolver.getObjectAndGetSetter(PropertyResolver.java:224)
        at 
org.apache.wicket.util.lang.PropertyResolver.getValue(PropertyResolver.java:91)
        at 
org.apache.wicket.model.AbstractPropertyModel.getObject(AbstractPropertyModel.java:113)

I have attached a QuickStart (with 2 test; 1 with the current PropertyResolver 
and 1 with the patched PropertyResolver) and a patch file.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to