From 4f2e01ce0175434240f523e9722f1cd236c7afde Mon Sep 17 00:00:00 2001 From: Michal Kabaj Date: Mon, 13 Aug 2018 12:21:07 +0200 Subject: Fix for NullPointerException in Pnf - Fix: Since lambda expressions are evaluated lazily, Camunda flow results in an NPE being thrown if RuntimeService is not acquired as part of invoking thread. - Modified integration test CreateAndActivatePnfResourceTest to verify the fix. Change-Id: I683a8400c81b2edd9d55f2a1d4121a4fdbdf820c Issue-ID: SO-722 Signed-off-by: Michal Kabaj --- .../so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap') diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java index bb490a06e4..61b1ca4cae 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java @@ -20,6 +20,7 @@ package org.onap.so.bpmn.infrastructure.pnf.delegate; +import org.camunda.bpm.engine.RuntimeService; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.camunda.bpm.engine.delegate.JavaDelegate; import org.onap.so.bpmn.infrastructure.pnf.dmaap.DmaapClient; @@ -30,12 +31,15 @@ public class InformDmaapClient implements JavaDelegate { private DmaapClient dmaapClient; @Override - public void execute(DelegateExecution execution) throws Exception { + public void execute(DelegateExecution execution) { String correlationId = (String) execution.getVariable(ExecutionVariableNames.CORRELATION_ID); - dmaapClient.registerForUpdate(correlationId, () -> execution.getProcessEngineServices().getRuntimeService() + RuntimeService runtimeService = execution.getProcessEngineServices().getRuntimeService(); + dmaapClient.registerForUpdate(correlationId, () -> + runtimeService .createMessageCorrelation("WorkflowMessage") .processInstanceBusinessKey(execution.getProcessBusinessKey()) - .correlateWithResult()); + .correlateWithResult() + ); } @Autowired -- cgit 1.2.3-korg