[rules-users] npe in LogicalRetractCallback when using jpa persistence

Chris Raschl c.raschl at dyless.com
Thu Aug 5 07:53:02 EDT 2010


Hi guys,
I think I've found a problem in the TruthMaintenanceSystem and would 
like to know if its a real bug or if I've made some mistake...

I'm using the latest drools and drools flow snapshot with jpa persistence.

When I'm retracting a fact from the knowledge session (which causes 
logical retraction), the session can't be persisted any more.

During retraction a LogicalRetractCallback is instantiated using this 
constructor:

public LogicalRetractCallback(final TruthMaintenanceSystem tms,
                               final LogicalDependency node,
                               final Set set,
                               final InternalFactHandle handle,
                               final PropagationContext context,
                               final Activation activation) {
     this.tms = tms;
     this.node = node;
     this.set = set;
     this.handle = handle;
     this.context = context;
}

As you can see an activation object can be passed (and actually is 
passed) to the constructor, but is never used. Retraction works though.

The problem occurs when the knowledge session is persisted, because
LogicalRetractCallback.write assumes that activation is not null, which 
leads to this npe:

Caused by: java.lang.NullPointerException
org.drools.common.TruthMaintenanceSystem$LogicalRetractCallback.write(TruthMaintenanceSystem.java:251)
org.drools.marshalling.impl.OutputMarshaller.writeActionQueue(OutputMarshaller.java:201)

It would be cool if anyone could have a look at this...

Thanks,
chris




More information about the rules-users mailing list