Change to fix issues in overridden validations of ParameterGroups
Currently, for validation of nested ParameterGroup classes, a new
GroupValidationResult is directly created instead of calling the
validate method of nested classes. Thus any overridden validate methods
won't work. This is fixed.
Change-Id: I8ee9265b295cb68d67926128b5b68c217f341034
Issue-ID: POLICY-1744
Signed-off-by: a.sreekumar <ajith.sreekumar@est.tech>
diff --git a/common-parameters/src/main/java/org/onap/policy/common/parameters/GroupValidationResult.java b/common-parameters/src/main/java/org/onap/policy/common/parameters/GroupValidationResult.java
index ad2eb69..fd68045 100644
--- a/common-parameters/src/main/java/org/onap/policy/common/parameters/GroupValidationResult.java
+++ b/common-parameters/src/main/java/org/onap/policy/common/parameters/GroupValidationResult.java
@@ -109,7 +109,12 @@
// Nested parameter groups are allowed
if (ParameterGroup.class.isAssignableFrom(fieldType)) {
- return new GroupValidationResult((ParameterGroup) fieldObject);
+ if (null != fieldObject) {
+ return ((ParameterGroup) fieldObject).validate();
+ }
+ else {
+ return new GroupValidationResult((ParameterGroup) fieldObject);
+ }
}
// Nested maps of parameter groups are allowed