[jboss-jira] [JBoss JIRA] (DROOLS-2552) KieBase Deserialization: NullPointerException

Florian Braun (JIRA) issues at jboss.org
Tue May 15 18:37:00 EDT 2018


     [ https://issues.jboss.org/browse/DROOLS-2552?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Florian Braun updated DROOLS-2552:
----------------------------------
    Description: 
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


  was:
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 rule does not use () the error does *not* occur.
If the rules are not in an rfg this error does *not* occur




> 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
>
> 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.5.0#75005)


More information about the jboss-jira mailing list