From 22360c78d550a25b9bdaea12cdb208371b69a488 Mon Sep 17 00:00:00 2001 From: "andre.schmid" Date: Fri, 12 Jul 2019 12:33:10 +0000 Subject: Allow relative path for SOL004 descriptors import Allow the use of relative path on SOL004 descriptors imports. Resolves imports with "/", "../" or "./" entries during validation and package processing. Validate if the reference is inside the package. Fix problem where imported descriptor files, described as a non string scalar yaml entry, were not being checked by the validator. Change-Id: Ie5a32736b6090b4adf178e8714f7460bcd068def Issue-ID: SDC-2422 Signed-off-by: andre.schmid --- .../org/openecomp/sdc/common/errors/Messages.java | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'openecomp-be/lib/openecomp-common-lib/src') diff --git a/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/errors/Messages.java b/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/errors/Messages.java index 578016657b..12359fdb14 100644 --- a/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/errors/Messages.java +++ b/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/errors/Messages.java @@ -14,10 +14,8 @@ * limitations under the License. */ - package org.openecomp.sdc.common.errors; - public enum Messages { CANT_LOAD_HEALING_CLASS("Can't load healing class %s."), @@ -111,8 +109,8 @@ public enum Messages { /*definition errors*/ MISSING_DEFINITION_FILE("Definition file %s referenced in TOSCA.meta does not exist"), - MISSING_IMPORT_FILE("Package must contain the referenced import file %s in %s directory"), - INVALID_IMPORT_STATEMENT("Definition file contains an invalid import statement in %s"), + MISSING_IMPORT_FILE("Package must contain the referenced import file '%s'"), + INVALID_IMPORT_STATEMENT("Definition file '%s' contains an invalid import statement: '%s'"), /* content errors*/ INVALID_YAML_FORMAT("Invalid YAML format - %s"), @@ -194,7 +192,7 @@ public enum Messages { private String errorMessage; - Messages(String errorMessage) { + Messages(final String errorMessage) { this.errorMessage = errorMessage; } @@ -202,4 +200,15 @@ public enum Messages { return errorMessage; } + /** + * Formats the message with the given parameters. + * + * @param params The message string parameters to apply + * @return + * The formatted message. + */ + public String formatMessage(final String... params) { + return String.format(errorMessage, params); + } + } -- cgit 1.2.3-korg