Skip to content

Commit

Permalink
Improve exception being thrown when process model is fetched and no c…
Browse files Browse the repository at this point in the history
…ontext is active (currently odd exception about v5 process definition is being thrown)
  • Loading branch information
Joram Barrez authored and Joram Barrez committed Jun 6, 2017
1 parent 2f51c47 commit 87de80c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -834,6 +834,7 @@ public ProcessEngine buildProcessEngine() {
if (flowable5CompatibilityEnabled && flowable5CompatibilityHandler != null) {
Context.setProcessEngineConfiguration(processEngine.getProcessEngineConfiguration());
flowable5CompatibilityHandler.getRawProcessEngine();
Context.removeProcessEngineConfiguration();
}

postProcessEngineInitialisation();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import org.flowable.bpmn.model.BpmnModel;
import org.flowable.bpmn.model.Process;
import org.flowable.engine.common.api.FlowableException;
import org.flowable.engine.common.api.FlowableObjectNotFoundException;
import org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl;
import org.flowable.engine.impl.context.Context;
Expand Down Expand Up @@ -51,7 +52,10 @@ public static ProcessDefinition getProcessDefinition(String processDefinitionId,
}

public static Process getProcess(String processDefinitionId) {
if (Context.getProcessEngineConfiguration() == null) {
if (Context.getCommandContext() == null) {
throw new FlowableException("Cannot get process model: no current command context is active");

} else if (Context.getProcessEngineConfiguration() == null) {
return Flowable5Util.getFlowable5CompatibilityHandler().getProcessDefinitionProcessObject(processDefinitionId);

} else {
Expand Down

0 comments on commit 87de80c

Please sign in to comment.