diff options
author | andre.schmid <andre.schmid@est.tech> | 2019-07-31 13:40:17 +0000 |
---|---|---|
committer | andre.schmid <andre.schmid@est.tech> | 2019-07-31 13:40:17 +0000 |
commit | 527fe8bdac1f1c7c59738c598996dc8c842a22e3 (patch) | |
tree | 815745b7dea0a0ffba8eccc2ef9dca7deb9b914e /src/main/java/org/onap | |
parent | d0d5690f13b9c794044bfe6bd7ac87557dd3dcea (diff) |
Fix one validation error that was going to stdout instead of normal
handling through ThreadsLocalHolder singleton.
Issue-ID: SDC-2344
Change-Id: I34827aa1314f2b65eff7b92fce7890eeddbca0e6
Signed-off-by: andre.schmid <andre.schmid@est.tech>
Diffstat (limited to 'src/main/java/org/onap')
-rw-r--r-- | src/main/java/org/onap/sdc/toscaparser/api/TopologyTemplate.java | 5 | ||||
-rw-r--r-- | src/main/java/org/onap/sdc/toscaparser/api/common/JToscaValidationIssue.java | 20 |
2 files changed, 24 insertions, 1 deletions
diff --git a/src/main/java/org/onap/sdc/toscaparser/api/TopologyTemplate.java b/src/main/java/org/onap/sdc/toscaparser/api/TopologyTemplate.java index 2160527..efc6948 100644 --- a/src/main/java/org/onap/sdc/toscaparser/api/TopologyTemplate.java +++ b/src/main/java/org/onap/sdc/toscaparser/api/TopologyTemplate.java @@ -119,7 +119,10 @@ public class TopologyTemplate { } if ((parsedParams != null && parsedParams.get(input.getName()) == null || parsedParams == null) && input.isRequired() && input.getDefault() == null) { - System.out.format("Log warning: The required parameter \"%s\" is not provided\n", input.getName()); + ThreadLocalsHolder.getCollector().appendValidationIssue(new JToscaValidationIssue("JE003", + String.format("MissingRequiredFieldError: The required input \"%s\" was not provided" + , input.getName())) + ); } alInputs.add(input); } diff --git a/src/main/java/org/onap/sdc/toscaparser/api/common/JToscaValidationIssue.java b/src/main/java/org/onap/sdc/toscaparser/api/common/JToscaValidationIssue.java index 19c9583..cd5cbc5 100644 --- a/src/main/java/org/onap/sdc/toscaparser/api/common/JToscaValidationIssue.java +++ b/src/main/java/org/onap/sdc/toscaparser/api/common/JToscaValidationIssue.java @@ -20,6 +20,8 @@ package org.onap.sdc.toscaparser.api.common; +import java.util.Objects; + public class JToscaValidationIssue { private String code; @@ -52,4 +54,22 @@ public class JToscaValidationIssue { public String toString() { return "JToscaError [code=" + code + ", message=" + message + "]"; } + + @Override + public boolean equals(final Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final JToscaValidationIssue that = (JToscaValidationIssue) o; + return Objects.equals(code, that.code) && + Objects.equals(message, that.message); + } + + @Override + public int hashCode() { + return Objects.hash(code, message); + } } |