diff options
author | romaingimbert <romain.gimbert@orange.com> | 2018-04-23 11:24:52 +0200 |
---|---|---|
committer | romaingimbert <romain.gimbert@orange.com> | 2018-04-23 11:32:16 +0200 |
commit | d748b3efcde68fcff85164898bdd35d529b4127b (patch) | |
tree | e1ddaf2c7e4a871045988911ecc7de13c96907f8 /src | |
parent | 58685658c5fd538387811fa126b48693502db7ba (diff) |
fix NPE on serviceInventory
-service without VNF
Change-Id: Ia61b6d63e2a35197074e7df70917d2aa6f53ee96
Issue-ID: EXTAPI-69
Signed-off-by: romaingimbert <romain.gimbert@orange.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/org/onap/nbi/apis/serviceinventory/ServiceInventoryService.java | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/main/java/org/onap/nbi/apis/serviceinventory/ServiceInventoryService.java b/src/main/java/org/onap/nbi/apis/serviceinventory/ServiceInventoryService.java index 707c9e9..a4347d4 100644 --- a/src/main/java/org/onap/nbi/apis/serviceinventory/ServiceInventoryService.java +++ b/src/main/java/org/onap/nbi/apis/serviceinventory/ServiceInventoryService.java @@ -102,16 +102,19 @@ public class ServiceInventoryService { List<LinkedHashMap> vnfs = new ArrayList<>(); LinkedHashMap relationShip = (LinkedHashMap) serviceResponse.get("relationship-list"); - List<LinkedHashMap> relationsList = (List<LinkedHashMap>) relationShip.get("relationship"); - for (LinkedHashMap relation : relationsList) { - String relatedLink = (String) relation.get("related-link"); - LinkedHashMap vnf = aaiClient.getVNF(relatedLink); - if (vnf != null) { - vnfs.add(vnf); + if(relationShip!=null) { + List<LinkedHashMap> relationsList = (List<LinkedHashMap>) relationShip.get("relationship"); + if(relationsList!=null) { + for (LinkedHashMap relation : relationsList) { + String relatedLink = (String) relation.get("related-link"); + LinkedHashMap vnf = aaiClient.getVNF(relatedLink); + if (vnf != null) { + vnfs.add(vnf); + } + } + serviceResponse.put("vnfs", vnfs); } } - serviceResponse.put("vnfs", vnfs); - } |