summaryrefslogtreecommitdiffstats
path: root/catalog-be
diff options
context:
space:
mode:
authorChris André <chris.andre@yoppworks.com>2020-04-21 20:41:08 -0400
committerOfir Sonsino <ofir.sonsino@intl.att.com>2020-04-22 10:56:30 +0000
commitc0e480a15a31efb9c0eaedd8d2033c363ccc8db9 (patch)
tree10eb2e2207d505e4faf87fe53d1baf309336736c /catalog-be
parent4873d824e7b3fdb3d2e96e348822383efcdd3f7d (diff)
Add null tests in `createComponentExternal`
Issue-ID: SDC-2916 Signed-off-by: Chris Andre <chris.andre@yoppworks.com> Change-Id: Ieb0a79c8d3a891a08cd758e1a4ebab7679166476
Diffstat (limited to 'catalog-be')
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/CrudExternalServlet.java6
1 files changed, 3 insertions, 3 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/CrudExternalServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/CrudExternalServlet.java
index 0c2f673fcf..4f374e0f54 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/CrudExternalServlet.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/CrudExternalServlet.java
@@ -264,19 +264,19 @@ public class CrudExternalServlet extends AbstractValidationsServlet {
}
//validate name exist
- if(responseWrapper.isEmpty() && isNullOrEmpty(service.getName())){
+ if(responseWrapper.isEmpty() && service != null && isNullOrEmpty(service.getName())){
responseWrapper.setInnerElement(getComponentsUtils().getResponseFormat(
ActionStatus.MISSING_COMPONENT_NAME, ComponentTypeEnum.SERVICE.getValue()));
}
//validate category
- if(responseWrapper.isEmpty() && service.getCategories().size()>0 && !ExternalCategoryTypeEnum.containsIgnoreCase(service.getCategories().get(0).getName())){
+ if(responseWrapper.isEmpty() && service != null && service.getCategories() != null && !service.getCategories().isEmpty() && !ExternalCategoryTypeEnum.containsIgnoreCase(service.getCategories().get(0).getName())){
log.debug("Service category is not supported {}", service.getCategories().get(0).getName());
responseWrapper.setInnerElement(getComponentsUtils().getResponseFormat(
ActionStatus.COMPONENT_INVALID_CATEGORY, ComponentTypeEnum.SERVICE.getValue()));
}
- if(responseWrapper.isEmpty()){
+ if(responseWrapper.isEmpty() && service != null){
service.setSystemName(ValidationUtils.convertToSystemName(service.getName()));
log.debug("Service system name :"+service.getSystemName());
}