diff --git a/jbpm-flow/src/main/java/org/jbpm/workflow/instance/impl/WorkflowProcessInstanceImpl.java b/jbpm-flow/src/main/java/org/jbpm/workflow/instance/impl/WorkflowProcessInstanceImpl.java index 9041f24388..4ced5937be 100644 --- a/jbpm-flow/src/main/java/org/jbpm/workflow/instance/impl/WorkflowProcessInstanceImpl.java +++ b/jbpm-flow/src/main/java/org/jbpm/workflow/instance/impl/WorkflowProcessInstanceImpl.java @@ -622,10 +622,9 @@ protected void registerExternalEventNodeListeners() { for (Node node : getWorkflowProcess().getNodes()) { if (node instanceof EventNode && "external".equals(((EventNode) node).getScope())) { String eventType = ((EventNode) node).getType(); + addEventListener(eventType, EMPTY_EVENT_LISTENER, true); if (isVariableExpression(eventType)) { addEventListener(resolveVariable(eventType), EMPTY_EVENT_LISTENER, true); - } else { - addEventListener(eventType, EMPTY_EVENT_LISTENER, true); } } else if (node instanceof EventSubProcessNode) { List events = ((EventSubProcessNode) node).getEvents(); @@ -648,10 +647,9 @@ private void unregisterExternalEventNodeListeners() { for (Node node : getWorkflowProcess().getNodes()) { if (node instanceof EventNode && "external".equals(((EventNode) node).getScope())) { String eventType = ((EventNode) node).getType(); + removeEventListener(eventType, EMPTY_EVENT_LISTENER, true); if (isVariableExpression(eventType)) { removeEventListener(resolveVariable(eventType), EMPTY_EVENT_LISTENER, true); - } else { - removeEventListener(eventType, EMPTY_EVENT_LISTENER, true); } } } @@ -909,7 +907,6 @@ private Optional resolveExpressionVariable(String paramName, VariableRes if(factory.isResolveable(paramName)) { return Optional.of(factory.getVariableResolver(paramName).getValue()); } - return Optional.ofNullable(MVELSafeHelper.getEvaluator().eval(paramName, factory)); } catch (Throwable t) { logger.error("Could not find variable scope for variable {}", paramName);