You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Igor Vaynberg (JIRA)" <ji...@apache.org> on 2009/07/03 17:58:47 UTC
[jira] Reopened: (WICKET-2337) IndexOutOfBoundsException when
PropertyResolver is using an invalid list index
[ https://issues.apache.org/jira/browse/WICKET-2337?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Igor Vaynberg reopened WICKET-2337:
-----------------------------------
needs to be ported to trunk
> 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.