次のルールに問題があります。
rule "Término sin Traducción"
salience -100
dialect "mvel"
when
traductor : TraductorDeEventosTratados()
eventoGenerico : EventoGenerico() from traductor.eventoGenerico
then
System.out.println("Evento generico: " + eventoGenerico);
traductor.setEventoGenerico( null );
update( traductor );
retract( eventoGenerico );
end
「 eventoGenerico NullPointerException
」をリトラクトすると、ワーキングメモリに存在しないかのように発生します(実際に存在し、別のルールで以前に設定eventoGenerico
されますtraductor
)。
Exception executing consequence for rule "Término sin Traducción" in RULA_PROV.SYSTEM_RULES: [Error: drools.retract( eventoGenerico ): null]
[Near : {... System.out.println("Evento gen ....}]
^
[Line: 1, Column: 1]
at org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:39)
at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1297)
ただし、この小さな変更を加えると、正常に機能します(これにより、eventoGenericoが実際に作業メモリーに存在することが確認されます)。
rule "Término sin Traducción"
salience -100
dialect "mvel"
when
traductor : TraductorDeEventosTratados()
eventoGenerico : EventoGenerico()
eventoGenerico2 : EventoGenerico( this == eventoGenerico ) from traductor.eventoGenerico
then
System.out.println("Evento generico: " + eventoGenerico);
traductor.setEventoGenerico( null );
update( traductor );
retract( eventoGenerico );
end
バグのようですが、何かアイデアはありますか?
前もって感謝します