
|
If you were logged in you would be able to see more operations.
|
|
|
|
Environment:
|
JDK 1.4.2/1.5
|
|
|
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())
|
|
Description
|
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())
|
Show » |
| There are no comments yet on this issue.
|
|