History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: OGNL-24
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Jesse Kuhnert
Reporter: Ben Dotte
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
OGNL

Property cast as java.util.List instead of intended interface

Created: 26/Mar/07 02:23 PM   Updated: 26/Mar/07 10:15 PM
Component/s: ExpressionCompiler
Affects Version/s: 2.7
Fix Version/s: None

Environment: Tapestry 4.1.2 snapshot from 3-21, OGNL 2.7 snapshot from 3-25, Firefox 2, WinXP


 Description  « Hide
This template snippet evaluates properly in OGNL 2.6:

<showAll jwcid="@ShowAll"
count="ognl:components.doxList.model.listSource.total" title=""
pageName="MyDocuments" >
  <div class="shadeIconIndent">
    <br/>
    <myDocs jwcid="doxList@MyDocumentsList"
allowItemsPerPageSelection="false"/>
  </div>
</showAll>

The count expression "ognl:components.doxList.model.listSource.total" is the problem in 2.7. This error appears in the stack trace:

Unable to parse OGNL expression
'components.doxList.model.listSource.total': Error compiling expression on object $BuilderAccount_106@3c1[BuilderAccount] with expression node components.doxList.model.listSource.total getter body: { return ($w) (((java.util.List)((collective.listcontainer.model.BaseListContainerMode
l)((collective.mb.ui.components.MyDocumentsList)(($BuilderAccount_106)$2
).getComponents().get("doxList")).getModel()).getListSource()).get(total
));} setter body: null

getListSource().get(total) should be getListSource().getTotal(). The concrete implementation of listSource both extends ArrayList and implements the ListSource interface, which has a getTotal() method that returns an int (the intended method). Presumably since it also extends ArrayList, getListSource() is being cast to java.util.List, at which point the get() method is being called.

I think OGNL 2.6's interpretation of getListSource().getTotal() makes more sense here than calling the get() method on java.util.List.

 All   Comments   Change History      Sort Order:
Jesse Kuhnert - [26/Mar/07 10:15 PM ]
Updated accessor to check for methods.