[
https://issues.jboss.org/browse/DROOLS-3880?page=com.atlassian.jira.plugi...
]
Almas Toimbekov commented on DROOLS-3880:
-----------------------------------------
Sorry, this was my fault. When I created separate project it worked fine. The problem is
that I had another resources with amount == null field.
What is the best way to get facts which field is not null?
Like this?
When
$resource: Resource(amount != null, Double.parseDouble(amount) > 0.0)
or
not Resource(amount == null)
$resource: Resource(Double.parseDouble(amount) > 0.0)
Then
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
Priority: Major
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)