summaryrefslogtreecommitdiffstats
path: root/catalog-be/src/main/java/org
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-be/src/main/java/org')
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/NodeFilterValidator.java38
1 files changed, 24 insertions, 14 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/NodeFilterValidator.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/NodeFilterValidator.java
index fccc034baa..021e6b49e4 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/NodeFilterValidator.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/NodeFilterValidator.java
@@ -183,23 +183,33 @@ public class NodeFilterValidator {
private Either<Boolean, ResponseFormat> validatePropertyData(UIConstraint uiConstraint,
Optional<? extends PropertyDefinition> sourceSelectedProperty,
Optional<? extends PropertyDefinition> targetComponentInstanceProperty) {
- final PropertyDefinition sourcePropDefinition = sourceSelectedProperty.get();
- final String sourceType = sourcePropDefinition.getType();
- final PropertyDefinition targetPropDefinition = targetComponentInstanceProperty.get();
- final String targetType = targetPropDefinition.getType();
- if (sourceType.equals(targetType)) {
- if (schemableTypes.contains(sourceType)) {
- final SchemaDefinition sourceSchemaDefinition = sourcePropDefinition.getSchema();
- final SchemaDefinition targetSchemaDefinition = targetPropDefinition.getSchema();
- if (!sourceSchemaDefinition.equals(targetSchemaDefinition)) {
- return Either.right(componentsUtils.getResponseFormat(ActionStatus.SOURCE_TARGET_SCHEMA_MISMATCH,
- uiConstraint.getServicePropertyName(), uiConstraint.getValue().toString()));
+ if (sourceSelectedProperty.isPresent() && targetComponentInstanceProperty.isPresent()) {
+ final PropertyDefinition sourcePropDefinition = sourceSelectedProperty.get();
+ final String sourceType = sourcePropDefinition.getType();
+ final PropertyDefinition targetPropDefinition = targetComponentInstanceProperty.get();
+ final String targetType = targetPropDefinition.getType();
+ if (sourceType.equals(targetType)) {
+ if (schemableTypes.contains(sourceType)) {
+ final SchemaDefinition sourceSchemaDefinition = sourcePropDefinition.getSchema();
+ final SchemaDefinition targetSchemaDefinition = targetPropDefinition.getSchema();
+ if (!sourceSchemaDefinition.equals(targetSchemaDefinition)) {
+ return Either
+ .right(componentsUtils.getResponseFormat(ActionStatus.SOURCE_TARGET_SCHEMA_MISMATCH,
+ uiConstraint.getServicePropertyName(), uiConstraint.getValue().toString()));
+ }
}
+ return Either.left(Boolean.TRUE);
+ } else {
+ return Either.right(componentsUtils.getResponseFormat(ActionStatus.SOURCE_TARGET_PROPERTY_TYPE_MISMATCH,
+ uiConstraint.getServicePropertyName(), uiConstraint.getValue().toString()));
}
- return Either.left(Boolean.TRUE);
} else {
- return Either.right(componentsUtils.getResponseFormat(ActionStatus.SOURCE_TARGET_PROPERTY_TYPE_MISMATCH,
- uiConstraint.getServicePropertyName(), uiConstraint.getValue().toString()));
+ LOGGER.debug(
+ "Null value passed to `validatePropertyData` - sourceSelectedProperty: '{}' - targetComponentInstanceProperty: '{}'",
+ sourceSelectedProperty, targetComponentInstanceProperty);
+ return Either.right(componentsUtils
+ .getResponseFormat(ActionStatus.GENERAL_ERROR, uiConstraint.getServicePropertyName(),
+ uiConstraint.getValue().toString()));
}
}