[jboss-jira] [JBoss JIRA] (DROOLS-1687) NPE in JavaAccumulatorFunctionContext.getAccumulatedObjects()

Geoffrey De Smet (JIRA) issues at jboss.org
Wed Aug 2 04:21:00 EDT 2017


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

Geoffrey De Smet edited comment on DROOLS-1687 at 8/2/17 4:20 AM:
------------------------------------------------------------------

Mario and I had a meeting, we decided to C) *fail fast with a helpful error message (including accumulate name and hopefully rule name etc)* and Mario will create a new jira linked here to have G) *the min/max functions also have reverseSupport if and only if a flag is true on the KieSession*.

Raw meeting notes:
{code}
A) return empty list // ge0ffrey: -1 (user doesn't know)

B) log warning; return empty list

C) Fail fast // ge0ffrey +1
    throw UnsupportedOperationException "The justification failed
        because the accumulate function (max) in rule (my hard constraint) on line 72 in foo.drl
        does not have reverseSupport"



D) minWithReverseSupport, maxWithReverseSupport
    con: users don't care and have to make a choice up front

E) min and max have reverseSupport always
    con: performance loss? how much?

F) Can we do E) with a flag on the KieBase?
    drools.setProperty("giveMinMaxReverseSupport" = true)


G) Can we do E) with a flag on the KieSession?
    drools.setProperty("giveMinMaxReverseSupport" = true)
        // OptaPlanner knows for each KieSession if it needs justification or not (= constraintMatchEnabled = true)


Proposal: C) in case they use a custom function without reverseSupport
          G) so C) doesn't happen much
{code}


was (Author: ge0ffrey):
Mario and I had a meeting, we decided to *fail fast with a helpful error message (including accumulate name and hopefully rule name etc)* and Mario will create a new jira linked here to have *the min/max functions also have reverseSupport if and only if a flag is true on the KieSession*.

Raw meeting notes:
{code}
A) return empty list // ge0ffrey: -1 (user doesn't know)

B) log warning; return empty list

C) Fail fast // ge0ffrey +1
    throw UnsupportedOperationException "The justification failed
        because the accumulate function (max) in rule (my hard constraint) on line 72 in foo.drl
        does not have reverseSupport"



D) minWithReverseSupport, maxWithReverseSupport
    con: users don't care and have to make a choice up front

E) min and max have reverseSupport always
    con: performance loss? how much?

F) Can we do E) with a flag on the KieBase?
    drools.setProperty("giveMinMaxReverseSupport" = true)


G) Can we do E) with a flag on the KieSession?
    drools.setProperty("giveMinMaxReverseSupport" = true)
        // OptaPlanner knows for each KieSession if it needs justification or not (= constraintMatchEnabled = true)


Proposal: C) in case they use a custom function without reverseSupport
          G) so C) doesn't happen much
{code}

> NPE in JavaAccumulatorFunctionContext.getAccumulatedObjects()
> -------------------------------------------------------------
>
>                 Key: DROOLS-1687
>                 URL: https://issues.jboss.org/browse/DROOLS-1687
>             Project: Drools
>          Issue Type: Bug
>          Components: core engine
>    Affects Versions: 7.1.0.Final
>            Reporter: Jiri Locker
>            Assignee: Mario Fusco
>         Attachments: DroolsReproducerTest.java
>
>
> Based on https://stackoverflow.com/questions/45161751/get-broken-constrains-in-optapanner-with-non-reversible-accumulator/.
> {code}
> Exception executing consequence for rule "requiredCpuPowerTotal" in testpkg: java.lang.NullPointerException
> 	at org.drools.core.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:39)
> 	...
> Caused by: java.lang.NullPointerException
> 	at org.drools.core.base.accumulators.JavaAccumulatorFunctionExecutor$JavaAccumulatorFunctionContext.getAccumulatedObjects(JavaAccumulatorFunctionExecutor.java:208)
> 	at org.drools.core.reteoo.FromNodeLeftTuple.getAccumulatedObjects(FromNodeLeftTuple.java:94)
> 	at org.drools.core.common.AgendaItem.getObjectsDeep(AgendaItem.java:79)
> 	at org.drools.core.reteoo.RuleTerminalNodeLeftTuple.getObjectsDeep(RuleTerminalNodeLeftTuple.java:359)
> {code}



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


More information about the jboss-jira mailing list