From a65e4772f4557a109917532b2d9c49680ce3bb15 Mon Sep 17 00:00:00 2001 From: liamfallon Date: Fri, 14 Sep 2018 16:45:06 +0100 Subject: 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 --- .../policy/apex/model/contextmodel/concepts/AxContextAlbum.java | 7 +++---- .../policy/apex/model/contextmodel/concepts/AxContextSchema.java | 8 ++++---- 2 files changed, 7 insertions(+), 8 deletions(-) (limited to 'model/context-model') 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) { -- cgit 1.2.3-korg