diff options
author | Lukasz Muszkieta <lukasz.muszkieta@nokia.com> | 2020-09-24 12:26:38 +0200 |
---|---|---|
committer | Lukasz Muszkieta <lukasz.muszkieta@nokia.com> | 2020-09-24 12:26:38 +0200 |
commit | 7c61f08d9fd61437a762fe57277b6f1f780a14cb (patch) | |
tree | 9f8a12d3b6926e487660eefb44da1142b8174bd7 /bpmn/MSOCommonBPMN/src/main/java | |
parent | 2505a543b0e45c1c3c2fe2fb8b85664b08bf2fca (diff) |
fix npe in ControllerExecutionBB
Issue-ID: SO-3266
Signed-off-by: Lukasz Muszkieta <lukasz.muszkieta@nokia.com>
Change-Id: Ib055c96bfd810fdf50e67d0c40fa6696850775a7
Diffstat (limited to 'bpmn/MSOCommonBPMN/src/main/java')
-rw-r--r-- | bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnf.java | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnf.java index 68161a8dd5..54922d4ea0 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnf.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnf.java @@ -34,6 +34,8 @@ final class BBInputSetupPnf { } static void populatePnfToServiceInstance(Pnfs pnfs, String pnfId, ServiceInstance serviceInstance) { + removePnfFromServiceIfExists(serviceInstance, pnfId); + Pnf pnf = new Pnf(); pnf.setPnfId(pnfId); pnf.setPnfName(pnfs.getInstanceName()); @@ -45,4 +47,9 @@ final class BBInputSetupPnf { serviceInstance.getPnfs().add(pnf); } + + private static void removePnfFromServiceIfExists(ServiceInstance serviceInstance, String pnfId) { + serviceInstance.getPnfs().stream().filter(pnf -> pnf.getPnfId().equals(pnfId)).findFirst() + .ifPresent(serviceInstance.getPnfs()::remove); + } } |