diff options
Diffstat (limited to 'model/context-model')
2 files changed, 7 insertions, 8 deletions
diff --git a/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextAlbum.java b/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextAlbum.java index 564e2d48c..3d008e992 100644 --- a/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextAlbum.java +++ b/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextAlbum.java @@ -274,11 +274,10 @@ public class AxContextAlbum extends AxConcept { "scope is not defined")); } - try { - Assertions.validateStringParameter(SCOPE_STRING, scope, SCOPE_REGEXP); - } catch (final IllegalArgumentException e) { + String stringCheckResult = Assertions.getStringParameterValidationMessage(SCOPE_STRING, scope, SCOPE_REGEXP); + if (stringCheckResult != null) { result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, - "scope invalid-" + e.getMessage())); + "scope invalid-" + stringCheckResult)); } if (itemSchema.equals(AxArtifactKey.getNullKey())) { diff --git a/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextSchema.java b/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextSchema.java index 5dad2e9e8..767b1d02e 100644 --- a/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextSchema.java +++ b/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextSchema.java @@ -234,11 +234,11 @@ public class AxContextSchema extends AxConcept { "schema flavour is not defined")); } - try { - Assertions.validateStringParameter(SCHEMA_FLAVOUR, schemaFlavour, SCHEMA_FLAVOUR_REGEXP); - } catch (final IllegalArgumentException e) { + String flavourValidationResult = Assertions.getStringParameterValidationMessage(SCHEMA_FLAVOUR, schemaFlavour, + SCHEMA_FLAVOUR_REGEXP); + if (flavourValidationResult != null) { result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, - "schema flavour invalid-" + e.getMessage())); + "schema flavour invalid-" + flavourValidationResult)); } if (schemaDefinition.replaceAll(WHITESPACE_REGEXP, "").length() == 0) { |