]
Mario Fusco commented on DROOLS-2552:
-------------------------------------
Poker: 2
KieBase Deserialization: NullPointerException
---------------------------------------------
Key: DROOLS-2552
URL:
https://issues.jboss.org/browse/DROOLS-2552
Project: Drools
Issue Type: Bug
Components: core engine
Affects Versions: 7.7.0.Final
Environment: Windows 7, Java 1.8, Drools 7.7.0.Final, jBPM 7.7.0.Final
Reporter: Florian Braun
Assignee: Mario Fusco
Priority: Critical
I have run into an issue with the KieBase serialization throwing a NullPointerException
when using exists and parentheses around an or when rules are in a RuleFlowGroup.
Example rules:
package com.sample.rules
rule "Your First Rule"
ruleflow-group "group1"
when
exists ( String(this == "Hello") or String(this == "World")
)
then
System.out.println("Hello or World");
end
rule "Your Second Rule"
ruleflow-group "group1"
when
$string: String(this == "Hello World")
then
System.out.println($string);
end
Having the first rule wrap the or in () will cause a deserialization NPE:
Exception in thread "main" java.lang.NullPointerException
at org.drools.core.common.BaseNode.getSinks(BaseNode.java:241)
at
org.drools.core.impl.KnowledgeBaseImpl.rewireNodeAfterDeserialization(KnowledgeBaseImpl.java:494)
at
org.drools.core.impl.KnowledgeBaseImpl.rewireNodeAfterDeserialization(KnowledgeBaseImpl.java:511)
at
org.drools.core.impl.KnowledgeBaseImpl.rewireNodeAfterDeserialization(KnowledgeBaseImpl.java:511)
at
org.drools.core.impl.KnowledgeBaseImpl.rewireNodeAfterDeserialization(KnowledgeBaseImpl.java:511)
at
org.drools.core.impl.KnowledgeBaseImpl.rewireReteAfterDeserialization(KnowledgeBaseImpl.java:489)
at org.drools.core.impl.KnowledgeBaseImpl.readExternal(KnowledgeBaseImpl.java:483)
....
Some testing shows this:
If the first rule is on its own then this error does *not* occur.
If the first rule does not use () the error does *not* occur. This of course means that
the rule behaves differently
If the rules are not in an rfg this error does *not* occur