[
https://issues.jboss.org/browse/DROOLS-2552?page=com.atlassian.jira.plugi...
]
Florian Braun commented on DROOLS-2552:
---------------------------------------
Thank you. This must have changed between 6 and 7? This was our one stumbling block trying
to upgrade and since maven is the canonical way to build the kiebases the lack of
documentation made this hard to figure out.
Our project has been using drools since 4 and we have a lot of our own code to mark up and
build kiebases and serialize them. I am trying to move the project to maven but doing so
is not an easy process so in the meantime the ability to programmatically build and
serialize is needed and appreciated. Thank you again.
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
--
This message was sent by Atlassian Jira
(v7.12.1#712002)