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

Key: OGNL-114
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Jesse Kuhnert
Reporter: David Frontini
Votes: 1
Watchers: 0
Operations

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

fails method name resolution for boolean JavaBean properties

Created: 03/Aug/07 06:25 AM   Updated: 04/Aug/07 01:24 PM
Component/s: Core Runtime
Affects Version/s: 2.7, 2.7.1
Fix Version/s: 2.7.1

Environment: JDK 1.4.2/1.5


 Description  « Hide
We have a simple class with two JavaBean boolean properties notAvailable and available with the assessor methods isNotAvailable and isAvailable.

OGNL runtime fails to method name resolution, for example:

import ognl.Node;
import ognl.Ognl;
import ognl.OgnlContext;


public class BooleanMethodOGNL {

public class BooleanTest {

public boolean isNotAvailable() {
return false;
}

public boolean isAvailable() {
return true;
}
}

public BooleanTest test = new BooleanTest();


public static void main(String[] args) {
OgnlContext context = new OgnlContext();

try {
System.out.println(((Node)Ognl.parseExpression("test.available")).toGetSourceString(context, new BooleanMethodOGNL()));
System.out.println(((Node)Ognl.parseExpression("test.notAvailable")).toGetSourceString(context, new BooleanMethodOGNL()));
} catch (Exception e) {
e.printStackTrace();
}
}

}

For both test the toGetSourceString method returns the same result: ".test.isNotAvailable()"

Failure occurs in the method ognl.OgnlRuntime.getReadMethod(Class, String, int) when tries to resolve the boolean properties access methods.
Probably the wrong if condition is:
                              methods[i].getName().toLowerCase().endsWith(name.toLowerCase())


 All   Comments   Change History      Sort Order:
There are no comments yet on this issue.