diff options
author | liamfallon <liam.fallon@ericsson.com> | 2018-09-14 16:45:06 +0100 |
---|---|---|
committer | liamfallon <liam.fallon@ericsson.com> | 2018-09-14 16:45:17 +0100 |
commit | a65e4772f4557a109917532b2d9c49680ce3bb15 (patch) | |
tree | 1669786f0b3ce82e005debc53218825d537841c8 /model/context-model | |
parent | 6d72a4a1e5d8678ecd8b093480ea9543089015b0 (diff) |
Fix exception not logged or rethrown
Eclipse sonarlint does not check for exception dropping by default,
it must be configured. This commit addresses exception dropping in
apex.
Change-Id: I406838990b3424c2912124b25d7326502cacc96c
Issue-ID: POLICY-1034
Signed-off-by: liamfallon <liam.fallon@ericsson.com>
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) { |