Commons OGNL
  1. Commons OGNL
  2. OGNL-24

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


    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.7
    • Fix Version/s: 4.0
    • Component/s: ExpressionCompiler
    • Labels:
    • Environment:
      Tapestry 4.1.2 snapshot from 3-21, OGNL 2.7 snapshot from 3-25, Firefox 2, WinXP


      This template snippet evaluates properly in OGNL 2.6:

      <showAll jwcid="@ShowAll"

      count="" title=""

      pageName="MyDocuments" >

      <div class="shadeIconIndent">


      <myDocs jwcid="doxList@MyDocumentsList"




      The count expression "" is the problem in 2.7. This error appears in the stack trace:

      Unable to parse OGNL expression

      '': Error compiling expression on object $BuilderAccount_106@3c1[BuilderAccount] with expression node 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.


        Ben Dotte created issue -
        Jesse Kuhnert added a comment -

        Updated accessor to check for methods.

        Jesse Kuhnert added a comment - Updated accessor to check for methods.
        Jesse Kuhnert made changes -
        Field Original Value New Value
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Tony Stevenson made changes -
        Project Import Mon Jun 18 09:00:45 UTC 2012 [ 1340010045016 ]
        Simone Tripodi made changes -
        Fix Version/s 4.0 [ 12323958 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Resolved Resolved
        7h 51m 1 Jesse Kuhnert 26/Mar/07 23:15


          • Assignee:
            Jesse Kuhnert
            Ben Dotte
          • Votes:
            0 Vote for this issue
            0 Start watching this issue


            • Created: