Details
-
Bug
-
Resolution: Won't Do
-
Major
-
None
-
7.0.0.Final
-
None
-
2019 Week 14-16
-
-
NEW
-
NEW
Description
When one inserts a new object in drl file and afterward wants to compare its String representation of a number with another number in next rules Drools gives an exception. It is much clearer with an example (below in code section)
Interesting that when you compare it as a String (amount == "10") - it works fine. But when you try to parse "amount" to Double then Java doesn't know that there is any value at all (thinks amount == null and therefore cannot parse it). The second interesting thing is that if you created this object (resource) in java and inserted it before "fireAllRules()" - "amount" field become visible to the parser and it works.
But the matter is that I cannot create this object before firing rules because I don't know wheter there will be a need of it. And my fields must be String as well. And I have to compare it like "more than" or "less than", so comparing strings doesn't apply.