Added fix for potential nullpointer exception 22/74122/1
authorChandan Ghosh <cghosh12@in.ibm.com>
Mon, 3 Dec 2018 08:57:48 +0000 (14:27 +0530)
committerChandan Ghosh <cghosh12@in.ibm.com>
Mon, 3 Dec 2018 08:57:54 +0000 (14:27 +0530)
Added fix for potential nullpointerexception

Issue-ID: SO-1263
Change-Id: Iaf7ab5b170ddcca03f597ab9f9a951afcee2d2f9
Signed-off-by: Chandan Ghosh <cghosh12@in.ibm.com>
adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java

index 2fc1c3d..e9018dd 100644 (file)
@@ -580,8 +580,9 @@ public class CatalogDbAdapterRest {
 
                 if (null == recipe) {
                     NetworkResource nResource = networkResourceRepo.findResourceByModelUUID(rmUuid);
-                    recipe = networkRecipeRepo.findFirstByModelNameAndActionAndVersionStr(nResource.getModelName(), action, vnf.getModelVersion());
-
+                    if(null!=vnf) {
+                       recipe = networkRecipeRepo.findFirstByModelNameAndActionAndVersionStr(nResource.getModelName(), action, vnf.getModelVersion());
+                    }
                     // for network fetch the default recipe
                     if (recipe == null) {
                         recipe = networkRecipeRepo.findFirstByModelNameAndAction("SDNC_DEFAULT", action);