Skip to content
New issue

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

ognl 3.4.3 string equals bug #309

Closed
hengyunabc opened this issue Nov 15, 2024 · 4 comments · Fixed by #337
Closed

ognl 3.4.3 string equals bug #309

hengyunabc opened this issue Nov 15, 2024 · 4 comments · Fixed by #337

Comments

@hengyunabc
Copy link
Contributor

https://github.com/hengyunabc/ognl34-bug-demo

ognl 3.4.3 result

"aaa".equals(params[0].flowAttribute.getBxApp()), result: false
"aaa" == params[0].flowAttribute.getBxApp(), result: true
params[0].flowAttribute.getBxApp().equals("aaa"), result: true

ognl 3.3.5 result

"aaa".equals(params[0].flowAttribute.getBxApp()), result: true
"aaa" == params[0].flowAttribute.getBxApp(), result: true
params[0].flowAttribute.getBxApp().equals("aaa"), result: true
@lukaszlenart
Copy link
Collaborator

Either using ognlContext.setRoot(advice); or Object object = Ognl.getValue(conditionExpress, advice); solves the problem. Yet I'm not able to figure it out why your example fails.

@lukaszlenart
Copy link
Collaborator

See the proposed fix, basically specifying root on context solves the problem, because due to changes in #204 null is returned instead.

lukaszlenart added a commit that referenced this issue Dec 29, 2024
lukaszlenart added a commit that referenced this issue Dec 29, 2024
Closes #309

Adds a test case to cover comparing strings

Closes #309
lukaszlenart added a commit that referenced this issue Dec 29, 2024
Closes #309

Adds a test case to cover comparing strings

Closes #309
@harawata
Copy link
Contributor

Hi @lukaszlenart ,

I apologize if this misses the point, but the Javadoc of Ognl#getValue(Object, OgnlContext, Object, Class<?>) says...

The default context is set for the given context and root via addDefaultContext().

But the call to addDefaultContext() is removed from getValue() and some other methods in #193.

I too am not fully understand, but could this cause the reported behavior change?

lukaszlenart added a commit that referenced this issue Dec 30, 2024
Closes #309

Adds a test case to cover comparing strings

Closes #309
lukaszlenart added a commit that referenced this issue Dec 30, 2024
Closes #309

Adds a test case to cover comparing strings

Closes #309
lukaszlenart added a commit that referenced this issue Dec 30, 2024
Closes #309

Adds a test case to cover comparing strings

Closes #309
@lukaszlenart
Copy link
Collaborator

@harawata good catch, thanks! I will revert back to addDefaultContext(root, context); as I cannot recall what did I remove it

lukaszlenart added a commit that referenced this issue Dec 30, 2024
Closes #309

Adds a test case to cover comparing strings

Closes #309
lukaszlenart added a commit that referenced this issue Dec 30, 2024
Closes #309

Adds a test case to cover comparing strings

Closes #309
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants