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

Key: OGNL-103
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Critical Critical
Assignee: Jesse Kuhnert
Reporter: Christian Nutz
Votes: 0
Watchers: 0
Operations

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

Unable to find correct readMethod named is...()

Created: 29/Jun/07 08:15 AM   Updated: 15/Jul/07 01:29 PM
Component/s: Core Runtime
Affects Version/s: 2.7
Fix Version/s: 2.7.1

Environment: Tapestry 4.1.2, OGNL 2.7, Java 1.5.0_11


 Description  « Hide
With OGNL 2.7 I'm unable to find the right Getter-Method nameed isDisabled() because it will find another is...Disabled()-Method like isEditorDisabled() first in the same class.

The failure should be in the method "public static Method getReadMethod(Class target, String name, int numParms)" lines 2108-2141in class OgnlRuntime (support for method names starting with "is" and "has" is missing). With OGNL 2.6.7 (which I've used together with Tapestry 4.0.2) all was running fine...



 All   Comments   Change History      Sort Order:
Jesse Kuhnert - [30/Jun/07 03:02 PM ]
I think I'm going to need more specific information on this as I'm currently unable to reproduce.

If you can show me a sample expression and a sample of the specific object types / values involved then that will help a lot.

Christian Nutz - [02/Jul/07 01:16 AM ]
Ok, I'll try to explain:

My component jwc:

<component-specification allow-body="no" allow-informal-parameters="yes" class="de.actano.rplan.pc.web.components.DetailPanel">

  <parameter name="disabled" required="no" default-value="false">
    <description>Boolean value</description>
  </parameter>

...

  <component id="cmbAdd" type="DropDown">
    <binding name="disabled" value="disabled"/>
...
  </component>

...

  <component id="commentEditor" type="CommentEditor">
    <binding name="disabled" value="commentEditorDisabled"/>
...
  </component>

...

</component-specification>

My component class:

public abstract class DetailPanel extends BaseComponent
{
    public abstract boolean isDisabled();

...

    public boolean isCommentEditorDisabled()
    {
        // Some extended checks....
    }
}

So, when component "cmbAdd" is being rendered, it asks for its property "disabled", which should return the value "disabled" from the parent component "DetailPanel", but instead of doing this, we'll jump into the method "isCommentEditorDisabled" in the class "DetailPanel". Let me say, that we have lots more of this is...EditorDisabled" in this class. I've debugged into OGNL class "OgnlRuntime", method "public static Method getReadMethod(Class target, String name, int numParms)" to see, whats happen. There are three loops to find the correct getter method named "isDisabled" is our case. But as the first loop doesn't check for methods starting with "is" or "has", we'll go into the second loop, which only checks, if the method ends with the name of the method to find, doesn't start with "set" and if the returnType is VOID - which is also true for "isCommentEditorDisabled". And because this method comes first in the method array, it is returned first.

I haven't checked the code from OGNL 2.6.7, but with this version, all went fine...






Christian Nutz - [02/Jul/07 05:22 AM ]
Oops, I mean "...the returnType isn't VOID"