Fix for Profile list RestAPI when profile is empty 83/121583/1
authorprakash.e <prakash.e@huawei.com>
Thu, 27 May 2021 15:07:59 +0000 (20:37 +0530)
committerprakash.e <prakash.e@huawei.com>
Fri, 28 May 2021 08:34:55 +0000 (14:04 +0530)
Change-Id: I664509037346758fade84c3cd84310a4f9ab87f4
Issue-ID: VNFSDK-785
Signed-off-by: Prakash.E <prakash.e@huawei.com>
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vtp/profile/VTPProfileResource.java

index a5c601d..cbb01a8 100644 (file)
@@ -76,7 +76,9 @@ public class VTPProfileResource extends VTPResource {
             for (Iterator<JsonElement> it = resultsArray.iterator(); it.hasNext();) {
                 JsonElement jsonElement = it.next();
                 JsonObject n = jsonElement.getAsJsonObject();
-                        list.getTestProfiles().add(new VTPTestProfile().setName(n.get("profile").getAsString()));
+                if (n.has("profile")){
+                    list.getTestProfiles().add(new VTPTestProfile().setName(n.get("profile").getAsString()));
+                }
             }
         }