diff options
Diffstat (limited to 'catalog-model/src')
2 files changed, 10 insertions, 4 deletions
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/PropertyOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/PropertyOperation.java index cd87dd4fe7..b54b401eb0 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/PropertyOperation.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/PropertyOperation.java @@ -33,8 +33,10 @@ import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonParseException; import com.google.gson.JsonParser; +import com.google.gson.JsonPrimitive; import com.google.gson.JsonSerializationContext; import com.google.gson.JsonSerializer; +import com.google.gson.JsonSyntaxException; import fj.data.Either; import java.io.IOException; import java.lang.reflect.InvocationTargetException; @@ -2143,6 +2145,10 @@ public class PropertyOperation extends AbstractOperation implements IPropertyOpe GreaterThanConstraint greaterThanConstraint = (GreaterThanConstraint) src; jsonArray.add(JsonParser.parseString(greaterThanConstraint.getGreaterThan())); result.add("greaterThan", jsonArray); + } else if (src instanceof LessThanConstraint) { + LessThanConstraint lessThanConstraint = (LessThanConstraint) src; + jsonArray.add(JsonParser.parseString(lessThanConstraint.getLessThan())); + result.add("lessThan", jsonArray); } else if (src instanceof LessOrEqualConstraint) { LessOrEqualConstraint lessOrEqualConstraint = (LessOrEqualConstraint) src; jsonArray.add(JsonParser.parseString(lessOrEqualConstraint.getLessOrEqual())); @@ -2185,8 +2191,9 @@ public class PropertyOperation extends AbstractOperation implements IPropertyOpe if (value != null) { if (value instanceof JsonArray) { JsonArray rangeArray = (JsonArray) value; - if (rangeArray.size() != 2) { + if (rangeArray.size() != 2 || rangeArray.contains(new JsonPrimitive(""))) { log.error("The range constraint content is invalid. value = {}", value); + throw new JsonSyntaxException("The range constraint content is invalid"); } else { InRangeConstraint rangeConstraint = new InRangeConstraint(); String minValue = rangeArray.get(0).getAsString(); @@ -2248,8 +2255,9 @@ public class PropertyOperation extends AbstractOperation implements IPropertyOpe case VALID_VALUES: if (value != null) { JsonArray rangeArray = (JsonArray) value; - if (rangeArray.size() == 0) { + if (rangeArray.size() == 0 || rangeArray.contains(new JsonPrimitive(""))) { log.error("The valid values constraint content is invalid. value = {}", value); + throw new JsonSyntaxException("The valid values constraint content is invalid"); } else { ValidValuesConstraint vvConstraint = new ValidValuesConstraint(); List<String> validValues = new ArrayList<>(); @@ -2426,7 +2434,6 @@ public class PropertyOperation extends AbstractOperation implements IPropertyOpe return null; } - } } diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/LessThanConstraint.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/LessThanConstraint.java index d0bea82157..740ee8b544 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/LessThanConstraint.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/LessThanConstraint.java @@ -35,7 +35,6 @@ import org.openecomp.sdc.be.model.tosca.constraints.exception.PropertyConstraint public class LessThanConstraint extends AbstractComparablePropertyConstraint { @NotNull - @Getter private String lessThan; @Override |