Bug 1022414

Summary: improving error message if process cannot be found
Product: [JBoss] JBoss Enterprise BRMS Platform 5 Reporter: Toshiya Kobayashi <tkobayas>
Component: jBPM 5Assignee: Kris Verlaenen <kverlaen>
Status: NEW --- QA Contact:
Severity: medium Docs Contact:
Priority: unspecified    
Version: BRMS 5.3.1   
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Toshiya Kobayashi 2013-10-23 08:52:35 UTC
Description of problem:

Backport the following commit to BRMS 5.3.x.

https://github.com/droolsjbpm/jbpm/commit/69851706a1bdad306a077ffa9cf24bf294859da4

Current implementation causes NullPointerException in processInstance.setProcess() if process == null.

        processInstance.setProcessId( processId );
        Process process = ruleBase.getProcess( processId );
        if ( ruleBase != null ) {
            processInstance.setProcess( process );
        }


Steps to Reproduce:
1. Start a process instance which has a safe point so the process instance is persisted.
2. Create a new kbase which doesn't have the process definition of the process instance.
3. Create a new ksession from the kbase
4. ksession.getProcessInstance(pid)

Actual results:

Exception in thread "main" java.lang.NullPointerException
	at org.jbpm.process.instance.impl.ProcessInstanceImpl.setProcess(ProcessInstanceImpl.java:61)
	at org.jbpm.marshalling.impl.AbstractProtobufProcessInstanceMarshaller.readProcessInstance(AbstractProtobufProcessInstanceMarshaller.java:375)
	at org.jbpm.persistence.processinstance.ProcessInstanceInfo.getProcessInstance(ProcessInstanceInfo.java:142)
	at org.jbpm.persistence.processinstance.JPAProcessInstanceManager.getProcessInstance(JPAProcessInstanceManager.java:83)
	at org.jbpm.process.instance.ProcessRuntimeImpl.getProcessInstance(ProcessRuntimeImpl.java:205)
	at org.drools.common.AbstractWorkingMemory.getProcessInstance(AbstractWorkingMemory.java:1100)
	at org.drools.impl.StatefulKnowledgeSessionImpl.getProcessInstance(StatefulKnowledgeSessionImpl.java:295)
	at org.drools.command.runtime.process.GetProcessInstanceCommand.execute(GetProcessInstanceCommand.java:48)
	at org.drools.command.runtime.process.GetProcessInstanceCommand.execute(GetProcessInstanceCommand.java:25)
	at org.drools.command.impl.DefaultCommandService.execute(DefaultCommandService.java:36)
	at org.drools.persistence.SingleSessionCommandService.execute(SingleSessionCommandService.java:360)
	at org.drools.command.impl.CommandBasedStatefulKnowledgeSession.getProcessInstance(CommandBasedStatefulKnowledgeSession.java:125)
	at com.sample.ProcessMainJPA.main(ProcessMainJPA.java:86)


Expected results:

Throws a RuntimeException("Could not find process "...