-
Type:
Bug Report
-
Resolution: Unresolved
-
Priority:
L3 - Default
-
None
-
Affects Version/s: 7.3.0
-
Component/s: bpmn model api, engine
-
None
See the test case below. It fails with this exception:
org.camunda.bpm.engine.ProcessEngineException: Delegate expression did neither resolve to an implementation of interface org.camunda.bpm.engine.impl.pvm.delegate.ActivityBehavior nor interface org.camunda.bpm.engine.delegate.JavaDelegate at org.camunda.bpm.engine.impl.bpmn.behavior.ServiceTaskDelegateExpressionActivityBehavi
As you can see a "ServiceTaskDelegateExpressionActivityBehavior" was choosen - even if I set
serviceTask.setCamundaDelegateExpression(null);
I digged a bit into it and found that this results in havind the
delegateExpression=""
Hence an empty string instead of null.
Not sure if this is a bug in the ModelAPI or if it should better be checked for emptry string in
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java#L1697
as done with expressions as well. https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java#L1703
@Test public void testModelApiBug() { BpmnModelInstance modelInstance = Bpmn.createEmptyModel(); Definitions definitions = modelInstance.newInstance(Definitions.class); definitions.setTargetNamespace("http://camunda.org/examples"); modelInstance.setDefinitions(definitions); org.camunda.bpm.model.bpmn.instance.Process process = modelInstance.newInstance(org.camunda.bpm.model.bpmn.instance.Process.class); process.setId("test"); definitions.addChildElement(process); StartEvent startEvent = modelInstance.newInstance(StartEvent.class); startEvent.setAttributeValue("id", "startEvent1", true); process.addChildElement(startEvent); ServiceTask serviceTask = modelInstance.newInstance(ServiceTask.class); serviceTask.setAttributeValue("id", "serviceTask1", true); serviceTask.setCamundaClass(null); serviceTask.setCamundaDelegateExpression(null); serviceTask.setCamundaExpression("#{true}"); // Noop process.addChildElement(serviceTask); createSequenceFlow(process, startEvent, serviceTask); repositoryService().createDeployment().addModelInstance("test.bpmn", modelInstance).deploy(); runtimeService().startProcessInstanceByKey("test"); } public SequenceFlow createSequenceFlow(org.camunda.bpm.model.bpmn.instance.Process process, FlowNode from, FlowNode to) { String identifier = from.getId() + "-" + to.getId(); SequenceFlow sequenceFlow = createElement(process, identifier, SequenceFlow.class); process.addChildElement(sequenceFlow); sequenceFlow.setSource(from); from.getOutgoing().add(sequenceFlow); sequenceFlow.setTarget(to); to.getIncoming().add(sequenceFlow); return sequenceFlow; } protected <T extends BpmnModelElementInstance> T createElement(BpmnModelElementInstance parentElement, String id, Class<T> elementClass) { T element = parentElement.getModelInstance().newInstance(elementClass); element.setAttributeValue("id", id, true); parentElement.addChildElement(element); return element; }