diff options
author | andre.schmid <andre.schmid@est.tech> | 2019-07-12 12:33:10 +0000 |
---|---|---|
committer | Oren Kleks <orenkle@amdocs.com> | 2019-07-21 09:37:45 +0000 |
commit | 22360c78d550a25b9bdaea12cdb208371b69a488 (patch) | |
tree | e8dc4fdc7ab5933ba13e68f081f185a7153bb8ae /openecomp-be/lib/openecomp-common-lib | |
parent | 9a3add2d727723877bbc6119d9b1f4a5d49fccc6 (diff) |
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 <andre.schmid@est.tech>
Diffstat (limited to 'openecomp-be/lib/openecomp-common-lib')
-rw-r--r-- | openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/errors/Messages.java | 19 |
1 files changed, 14 insertions, 5 deletions
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); + } + } |