[jboss-jira] [JBoss JIRA] (DROOLS-5076) Rule compilation fails with date constraints on nested fact types
Matteo Casalino (Jira)
issues at jboss.org
Tue Feb 18 06:14:00 EST 2020
[ https://issues.redhat.com/browse/DROOLS-5076?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Matteo Casalino updated DROOLS-5076:
------------------------------------
Description:
As of Drools 7.32.0.Final, patterns containing constraints on nested dates won't compile.
For instance, given the following drl:
{noformat}
declare Fact
n : Nested
end
declare Nested
d : java.util.Date
end
rule "with nested date"
when
Fact(n!.d >= "01-Jan-2020", n!.d <= "10-Jan-2020")
then
end
{noformat}
we get the following error:
{noformat}
Message [id=1, kieBase=forall-date-constraint, level=ERROR, path=org/drools/reproducer/rules.drl, line=-1, column=0
text=Unable to Analyse Expression n.d >= "01-Jan-2020":
[Error: Comparison operation requires compatible types. Found class java.util.Date and class java.lang.String]
[Near : {... n.d >= "01-Jan-2020" ....}]
^]
Message [id=2, kieBase=forall-date-constraint, level=ERROR, path=org/drools/reproducer/rules.drl, line=-1, column=0
text=Unable to Analyse Expression n.d <= "10-Jan-2020":
[Error: Comparison operation requires compatible types. Found class java.util.Date and class java.lang.String]
[Near : {... n.d <= "10-Jan-2020" ....}]
^]
{noformat}
We don't reproduce with Drools <= 7.31.0.Final
was:
As of Drools 7.32.0.Final, patterns containing constraints on nested dates won't compile.
For instance, given the following drl:
{noformat}
declare Fact
n : Nested
end
declare Nested
d : java.util.Date
end
rule "with nested date"
when
Fact(n!.d >= "01-Jan-2020", n!.d <= "10-Jan-2020")
then
end
{noformat}
we get the following error:
Message [id=1, kieBase=forall-date-constraint, level=ERROR, path=org/drools/reproducer/rules.drl, line=-1, column=0
text=Unable to Analyse Expression n.d >= "01-Jan-2020":
[Error: Comparison operation requires compatible types. Found class java.util.Date and class java.lang.String]
[Near : {... n.d >= "01-Jan-2020" ....}]
^]
Message [id=2, kieBase=forall-date-constraint, level=ERROR, path=org/drools/reproducer/rules.drl, line=-1, column=0
text=Unable to Analyse Expression n.d <= "10-Jan-2020":
[Error: Comparison operation requires compatible types. Found class java.util.Date and class java.lang.String]
[Near : {... n.d <= "10-Jan-2020" ....}]
^]
{noformat}
We don't reproduce with Drools <= 7.31.0.Final
> Rule compilation fails with date constraints on nested fact types
> -----------------------------------------------------------------
>
> Key: DROOLS-5076
> URL: https://issues.redhat.com/browse/DROOLS-5076
> Project: Drools
> Issue Type: Bug
> Components: core engine
> Affects Versions: 7.32.0.Final, 7.33.0.Final
> Reporter: Matteo Casalino
> Assignee: Mario Fusco
> Priority: Major
> Attachments: nested-date-constraint.tgz
>
>
> As of Drools 7.32.0.Final, patterns containing constraints on nested dates won't compile.
> For instance, given the following drl:
> {noformat}
> declare Fact
> n : Nested
> end
> declare Nested
> d : java.util.Date
> end
> rule "with nested date"
> when
> Fact(n!.d >= "01-Jan-2020", n!.d <= "10-Jan-2020")
> then
> end
> {noformat}
> we get the following error:
> {noformat}
> Message [id=1, kieBase=forall-date-constraint, level=ERROR, path=org/drools/reproducer/rules.drl, line=-1, column=0
> text=Unable to Analyse Expression n.d >= "01-Jan-2020":
> [Error: Comparison operation requires compatible types. Found class java.util.Date and class java.lang.String]
> [Near : {... n.d >= "01-Jan-2020" ....}]
> ^]
> Message [id=2, kieBase=forall-date-constraint, level=ERROR, path=org/drools/reproducer/rules.drl, line=-1, column=0
> text=Unable to Analyse Expression n.d <= "10-Jan-2020":
> [Error: Comparison operation requires compatible types. Found class java.util.Date and class java.lang.String]
> [Near : {... n.d <= "10-Jan-2020" ....}]
> ^]
> {noformat}
> We don't reproduce with Drools <= 7.31.0.Final
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
More information about the jboss-jira
mailing list