[rules-dev] NPE in update via wrong entry point

Wolfgang Laun wolfgang.laun at gmail.com
Fri Nov 5 06:17:15 EDT 2010


This sequence of statements disagrees with the documentation:

    WorkingMemoryEntryPoint entryPoint =
kSession.getWorkingMemoryEntryPoint( "epn" );
    FactHandle fh = entryPoint.insert( fact );
    kSession.update( fh, fact );   // should be done using entryPoint.update

But this causes (in 5.1.1) a NPE
Exception in thread "main" java.lang.NullPointerException
    at
org.drools.common.AbstractWorkingMemory.update(AbstractWorkingMemory.java:1379)
    at
org.drools.common.AbstractWorkingMemory.update(AbstractWorkingMemory.java:1338)
    at
org.drools.impl.StatefulKnowledgeSessionImpl.update(StatefulKnowledgeSessionImpl.java:266)
    at event.Main.execute(Main.java:153)
    at event.Main.main(Main.java:164)

This is the line:
   if ( this.maintainTms ) {
                status = ((InternalFactHandle)
factHandle).getEqualityKey().getStatus();
  }

and similar code can be found in trunk, so I suppose this is still possible.

-W
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-dev/attachments/20101105/c7c5873f/attachment.html 


More information about the rules-dev mailing list