aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-be
diff options
context:
space:
mode:
authorshikha0203 <shivani.khare@est.tech>2023-02-17 13:15:51 +0000
committershikha0203 <shivani.khare@est.tech>2023-02-17 15:15:30 +0000
commitc947189eb1a342ee14e1aebc43d45b41bf0d3dd6 (patch)
tree8c01c0514a4b1045dc9a6571ceed35511bbcfd3d /catalog-be
parent79e0633593b93177f842499ca6389acd495cd29a (diff)
AbstractTemplateServlet- fix null test for "tags"
Issue-ID: SDC-4397 Signed-off-by: shikha0203 <shivani.khare@est.tech> Change-Id: Ia95e76c5ddbed740cbfbab581b0d8fdc56e90194
Diffstat (limited to 'catalog-be')
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/AbstractTemplateServlet.java8
1 files changed, 7 insertions, 1 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/AbstractTemplateServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/AbstractTemplateServlet.java
index 19b2c3468b..411e0dcfd9 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/AbstractTemplateServlet.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/AbstractTemplateServlet.java
@@ -26,6 +26,7 @@ import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.servers.Server;
import io.swagger.v3.oas.annotations.tags.Tag;
import java.io.IOException;
+import java.util.ArrayList;
import java.util.List;
import javax.inject.Inject;
import javax.servlet.http.HttpServletRequest;
@@ -38,6 +39,8 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
+
+import org.apache.commons.collections.CollectionUtils;
import org.openecomp.sdc.be.components.impl.AbstractTemplateBusinessLogic;
import org.openecomp.sdc.be.components.impl.ComponentInstanceBusinessLogic;
import org.openecomp.sdc.be.components.impl.ElementBusinessLogic;
@@ -226,13 +229,16 @@ public class AbstractTemplateServlet extends AbstractValidationsServlet {
log.debug("getServiceAbstractStatus: Service Fetching Success");
Service service = (Service) assetTypeData.left().value().get(0);
List<String> tags = service.getTags();
- if (tags != null && !tags.isEmpty()) {
+ if (CollectionUtils.isNotEmpty(tags)) {
+
for (int i = tags.size() - 1; i >= 0; i--) {
String tag = tags.get(i);
if (service.getName().equals(tag)) {
tags.remove(tag);
}
}
+ } else {
+ tags = new ArrayList<>();
}
service.setName(copyServiceInfo.getNewServiceName());
tags.add(copyServiceInfo.getNewServiceName());