[jboss-jira] [JBoss JIRA] Created: (JBRULES-3140) NullPointerException thrown on JPA synchronization.afterCompletion() clearProcessInstances()

Nick Bruno (JIRA) jira-events at lists.jboss.org
Wed Jul 13 10:56:23 EDT 2011


NullPointerException thrown on JPA synchronization.afterCompletion() clearProcessInstances()
--------------------------------------------------------------------------------------------

                 Key: JBRULES-3140
                 URL: https://issues.jboss.org/browse/JBRULES-3140
             Project: Drools
          Issue Type: Bug
      Security Level: Public (Everyone can see)
          Components: drools-core
    Affects Versions: 5.2.0.Final
            Reporter: Nick Bruno
            Assignee: Mark Proctor


In org.drools.persistence.SingleSessionCommandService$SynchronizationImpl.afterCompletion(), the following generates a NullPointerException when no processes are implemented.
{noformat}if ( ksession != null ) {
     ((InternalKnowledgeRuntime) ksession).getProcessRuntime().clearProcessInstances(); // NullPointerException
     ((JPAWorkItemManager) ksession.getWorkItemManager()).clearWorkItems();
}
{noformat} 
The fix is to grab the InternalProcessRuntime to a local variable and test if it is null before calling clearProcessInstances(), as so:
{noformat}InternalProcessRuntime ipr = ((InternalKnowledgeRuntime) ksession).getProcessRuntime();
if( ipr != null) {
     ipr.clearProcessInstances();
}{noformat} 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jboss-jira mailing list