-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Allow JsonNodeELResolver to invoke get
and path
#3996
Allow JsonNodeELResolver to invoke get
and path
#3996
Conversation
Thanks for the analysis and PR @rssap. That line is a bit dangerous as JUEL can coerce anything into a String. We've had mistakes before where someone would call a method accepting a string with some object and the objects I would be more keen on adjusting the We also try to avoid using mocks like in the test you have. A better test would be in |
Sounds good. I have adjusted the Small note: The expressions
|
@filiphr please have another look at my changes. |
@filiphr do you have any change requests? |
Hey @rssap, sorry for the late reply. I don't like the fact that we are embedding the I can look into this when merging the PR |
@rssap, I've done some polishing. Can you please review my changes. If you agree with them we can merge this |
...wable-engine-common/src/main/java/org/flowable/common/engine/impl/el/JsonNodeELResolver.java
Outdated
Show resolved
Hide resolved
…on/engine/impl/el/JsonNodeELResolver.java
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the feedback and the commit. LGTM 👍.
get
and path
This PR proposes a change to the
JsonNodeELResolver
to allow invoking theget
method on anArrayNode
.In this commit, the logic of the BeanELResolver was enhanced to better deal with method overloading.
We encountered some inconsistencies in the Behavior of the BeanELResolver compared to an older flowable release (in our case 6.6.0)
The ArrayNode has two methods with the name "get":
Before the mentioned commit, it was possible to use the BeanELResolver to invoke
ArrayNode::get
and pass a Long as parameter, which is no longer possible. Even though none of the two methods apply to a Long (without casting it to an int), I think that there is still a benefit in supporting it:${array.get(0)}
as a Long. Therefore, the BeanELResolver will try to invoke "get" with a Long as parameter.Based on @filiphr Feedback, I modified the
JsonNodeELResolver
rather than theBeanELResolver
.I have added a unit test to demonstrate the problem. The tests also pass on the state of
flowable-6.6.0
(some release before the logic of the BeanELResolver was changed).Without the modification to the
JsonNodeELResolver
, the test fails with the following exception:org.flowable.common.engine.impl.javax.el.MethodNotFoundException: Unable to find unambiguous method: class com.fasterxml.jackson.databind.node.ArrayNode.get(java.lang.Long)
Check List: