We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
If we have a public code field in a class, such as:
code
public class Something { public String code = "abc123"; }
And, being s an object of type Something, we execute this expression:
s
Something
s.code
Instead of returning "abc123", the hash code will be returned because the hashCode() method will be selected for execution.
"abc123"
hashCode()
The responsible for this is this block of code in OgnlRuntime: https://github.com/jkuhnert/ognl/blob/751084b4802b488e0386ab702e230cceca296254/src/java/ognl/OgnlRuntime.java#L2947-L2954
OgnlRuntime
if (methods[i].getName().toLowerCase().endsWith(name) && !methods[i].getName().startsWith("set") && methods[i].getMethod().getReturnType() != Void.TYPE) { Method m = methods[i].getMethod(); if (!candidates.contains(m)) candidates.add(m); }
IMHO the check applied here is far too lenient, especially given the fact that field names have not been checked yet by the time this executes…
The text was updated successfully, but these errors were encountered:
This is the cause of thymeleaf/thymeleaf#546
Sorry, something went wrong.
Yeah... but a public field isn't something normal in Java ecosystem...
8db64a5
Fixed. All tests pass. Thanks!
No branches or pull requests
If we have a public
code
field in a class, such as:And, being
s
an object of typeSomething
, we execute this expression:Instead of returning
"abc123"
, the hash code will be returned because thehashCode()
method will be selected for execution.The responsible for this is this block of code in
OgnlRuntime
: https://github.com/jkuhnert/ognl/blob/751084b4802b488e0386ab702e230cceca296254/src/java/ognl/OgnlRuntime.java#L2947-L2954IMHO the check applied here is far too lenient, especially given the fact that field names have not been checked yet by the time this executes…
The text was updated successfully, but these errors were encountered: