aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/BaseBusinessLogic.java2
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/utils/CollectionUtils.java12
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/PropertyDefinition.java5
3 files changed, 17 insertions, 2 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/BaseBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/BaseBusinessLogic.java
index 49dd3d6c01..643b9462bc 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/BaseBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/BaseBusinessLogic.java
@@ -764,7 +764,7 @@ public abstract class BaseBusinessLogic {
for (PropertyDefinition propertyDefinition : propertyDefinitions) {
if (propertyDefinition.getName().equals(anInputPathArr)) {
if (ToscaType.isPrimitiveType(propertyDefinition.getType())) {
- constraints.addAll(propertyDefinition.getConstraints());
+ constraints.addAll(propertyDefinition.safeGetConstraints());
} else {
type = propertyDefinition.getType();
}
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/utils/CollectionUtils.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/utils/CollectionUtils.java
index 7336859fd7..15bef3b23b 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/utils/CollectionUtils.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/utils/CollectionUtils.java
@@ -20,13 +20,23 @@
package org.openecomp.sdc.be.dao.utils;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
import java.util.Map.Entry;
+import java.util.Set;
public final class CollectionUtils {
private CollectionUtils() {
}
+ public static <T> List<T> safeGetList(List<T> listToCheck) {
+ return org.apache.commons.collections.CollectionUtils.isNotEmpty(listToCheck) ? listToCheck : Collections.emptyList();
+ }
+
/**
* Add the content of the 'source' Set to the 'target' set and return the
* union set.
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/PropertyDefinition.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/PropertyDefinition.java
index e09fe41b05..6d37cc365f 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/PropertyDefinition.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/PropertyDefinition.java
@@ -20,6 +20,7 @@
package org.openecomp.sdc.be.model;
+import org.openecomp.sdc.be.dao.utils.CollectionUtils;
import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
import java.util.List;
@@ -119,6 +120,10 @@ public class PropertyDefinition extends PropertyDataDefinition
return constraints;
}
+ public List<PropertyConstraint> safeGetConstraints() {
+ return CollectionUtils.safeGetList(constraints);
+ }
+
public void setConstraints(List<PropertyConstraint> constraints) {
this.constraints = constraints;
}