[jboss-jira] [JBoss JIRA] (DROOLS-3880) Bug when parsing fact from String to Double in Drools

Almas Toimbekov (Jira) issues at jboss.org
Mon Apr 15 00:32:00 EDT 2019


Almas Toimbekov created DROOLS-3880:
---------------------------------------

             Summary: Bug when parsing fact from String to Double in Drools
                 Key: DROOLS-3880
                 URL: https://issues.jboss.org/browse/DROOLS-3880
             Project: Drools
          Issue Type: Bug
          Components: core engine
    Affects Versions: 7.0.0.Final
         Environment: Ubuntu, Intellij Idea
            Reporter: Almas Toimbekov
            Assignee: Mario Fusco


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. 



--
This message was sent by Atlassian Jira
(v7.12.1#712002)


More information about the jboss-jira mailing list