[ 
https://issues.apache.org/jira/browse/WICKET-2337?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Johan Compagner closed WICKET-2337.
-----------------------------------

       Resolution: Fixed
    Fix Version/s: 1.3.7
         Assignee: Johan Compagner

fixed.
(also for arrays so not only the list one)

> IndexOutOfBoundsException when PropertyResolver is using an invalid list index
> ------------------------------------------------------------------------------
>
>                 Key: WICKET-2337
>                 URL: https://issues.apache.org/jira/browse/WICKET-2337
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.6
>            Reporter: Matthias Keller
>            Assignee: Johan Compagner
>             Fix For: 1.3.7
>
>
> When using  PropertyResolver.getValue("myList[1]", myBean),  the 
> PropertyResolver$ListGetSet.getValue() (line 762) unconditionally does:
> return ((List)object).get(index);
> which throws an   java.lang.IndexOutOfBoundsException: Index: 1, Size: 1  if 
> the backing list contains only one element (at index 0).
> Shouldn't the implementation rather return null like with every other 
> property not found? Like when using "bla.bli.blo" as a lookup string and 
> there is no bla field and no getBla() method?
> So this method should rather be:
> org.apache.wicket.util.lang.PropertyResolver$ListGetSet.getValue():
>               /**
>                * @see 
> org.apache.wicket.util.lang.PropertyResolver.IGetAndSet#getValue(java.lang.Object)
>                */
>               public Object getValue(Object object)
>               {
>                       List list = (List) object;
>                       if (index >= list.size()) {
>                               return null;
>                       }
>                       return list.get(index);
>               }

-- 
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