summaryrefslogtreecommitdiffstats
path: root/catalog-be/src/main/java
diff options
context:
space:
mode:
authorshikha0203 <shivani.khare@est.tech>2023-02-17 11:08:38 +0000
committershikha0203 <shivani.khare@est.tech>2023-02-17 11:08:38 +0000
commit79e0633593b93177f842499ca6389acd495cd29a (patch)
treef36cb2bbc2a0a7c4dd559359f1de6647847e290c /catalog-be/src/main/java
parent89d7125d6ae8a3f172ce7d6dc9546443d9477f5b (diff)
AttributeServlet- Add null test before using nullable values
Issue-ID: SDC-4396 Signed-off-by: shikha0203 <shivani.khare@est.tech> Change-Id: I41f9e072f9caa601c3a135e0d3205b9676638e8b
Diffstat (limited to 'catalog-be/src/main/java')
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/servlets/AttributeServlet.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/AttributeServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/AttributeServlet.java
index 6ea2ab1096..4056d607ad 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/AttributeServlet.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/AttributeServlet.java
@@ -115,6 +115,10 @@ public class AttributeServlet extends AbstractValidationsServlet {
try {
final Wrapper<ResponseFormat> errorWrapper = new Wrapper<>();
AttributeDefinition attributeDataDefinition = convertJsonToObject(data, errorWrapper);
+ if (attributeDataDefinition == null) {
+ log.error("Unexpected null value for `attributeDataDefinition`");
+ return buildErrorResponse(errorWrapper.getInnerElement());
+ }
if (errorWrapper.isEmpty()) {
AttributeBusinessLogic businessLogic = getClassFromWebAppContext(context, () -> AttributeBusinessLogic.class);
Either<AttributeDefinition, ResponseFormat> createAttribute = businessLogic
@@ -175,6 +179,10 @@ public class AttributeServlet extends AbstractValidationsServlet {
try {
final Wrapper<ResponseFormat> errorWrapper = new Wrapper<>();
AttributeDefinition attributeDataDefinition = convertJsonToObject(data, errorWrapper);
+ if (attributeDataDefinition == null) {
+ log.error("Unexpected null value for `attributeDataDefinition`");
+ return buildErrorResponse(errorWrapper.getInnerElement());
+ }
if (errorWrapper.isEmpty()) {
AttributeBusinessLogic businessLogic = getClassFromWebAppContext(context, () -> AttributeBusinessLogic.class);
Either<AttributeDefinition, ResponseFormat> eitherUpdateAttribute = businessLogic