[jboss-jira] [JBoss JIRA] (DROOLS-1451) NPE when building KieBase with OOPath in a declared window

Mario Fusco (JIRA) issues at jboss.org
Mon Feb 27 12:44:01 EST 2017


    [ https://issues.jboss.org/browse/DROOLS-1451?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13369834#comment-13369834 ] 

Mario Fusco commented on DROOLS-1451:
-------------------------------------

Since an oopath constraint is implemented through one or more FromNode it is not technically possible to allow to use it inside a declared window, in the same way as a declared window cannot contain a join condition. 

In fact to let this work the resulting rete network should be something like:

{code}
[EntryPointNode(1) EntryPoint::DEFAULT ] on Partition(MAIN)
    [ObjectTypeNode(2)::EntryPoint::DEFAULT objectType=[ClassObjectType class=org.drools.core.reteoo.InitialFactImpl] expiration=-1ms ] on Partition(MAIN)
        [LeftInputAdapterNode(5)] on Partition(1)
            [JoinNode(6) - [ClassObjectType event=org.drools.testcoverage.common.model.MessageEvent]] on Partition(1)
                [ReactiveFromNode(7) :: MessageEvent/getMsg{message == "Ping"}] on Partition(1)
                    [RuleTerminalNode(8): rule=R] on Partition(1)
    [ObjectTypeNode(3)::EntryPoint::DEFAULT objectType=[ClassObjectType event=org.drools.testcoverage.common.model.MessageEvent] expiration=3000ms ] on Partition(MAIN)
        [WindowNode(4) constraints=[]] on Partition(1)
            [JoinNode(6) - [ClassObjectType event=org.drools.testcoverage.common.model.MessageEvent]] on Partition(1)
{code}

with the WindowNode feeding the JoinNode of the rule where the declared window is used and the ReactiveFromNode implementing the oopath, below that JoinNode itself. This is clearly not possible.

> NPE when building KieBase with OOPath in a declared window
> ----------------------------------------------------------
>
>                 Key: DROOLS-1451
>                 URL: https://issues.jboss.org/browse/DROOLS-1451
>             Project: Drools
>          Issue Type: Bug
>          Components: core engine
>    Affects Versions: 7.0.0.Beta6
>         Environment: Reproducible with 7.0.0-SNAPSHOT.
>            Reporter: Marek Winkler
>            Assignee: Mario Fusco
>         Attachments: oopath-cep-stacktrace.txt
>
>
> When using an OOPath expression in a declared window (does not matter if a length or a time window), a NPE is thrown. For instance, a rule such as:
> {code}
> declare window Pings
>   MessageEvent( /msg{ message == 'Ping' } ) over window:length( 2 )
> end
> rule R when
>   $messageEvent: MessageEvent() from window Pings
> then
>   events.add( $messageEvent );
> end
> {code}
> produces the following exception (see the attachment for the full stacktrace) when building the KieBase:
> {code}
> java.lang.NullPointerException
> 	at org.drools.core.reteoo.builder.WindowReferenceBuilder.build(WindowReferenceBuilder.java:40)
> 	at org.drools.core.reteoo.builder.PatternBuilder.attachPattern(PatternBuilder.java:116)
> 	at org.drools.core.reteoo.builder.PatternBuilder.build(PatternBuilder.java:77)
> 	at org.drools.core.reteoo.builder.GroupElementBuilder$AndBuilder.build(GroupElementBuilder.java:108)
> 	at org.drools.core.reteoo.builder.GroupElementBuilder.build(GroupElementBuilder.java:68)
> 	at org.drools.core.reteoo.builder.ReteooRuleBuilder.addSubRule(ReteooRuleBuilder.java:164)
> 	at org.drools.core.reteoo.builder.ReteooRuleBuilder.addRule(ReteooRuleBuilder.java:136)
> 	at org.drools.core.reteoo.ReteooBuilder.addRule(ReteooBuilder.java:110)
> ...
> 	at org.drools.compiler.kie.builder.impl.KieContainerImpl.createKieBase(KieContainerImpl.java:630)
> ...
> {code}



--
This message was sent by Atlassian JIRA
(v7.2.3#72005)


More information about the jboss-jira mailing list