diff options
Diffstat (limited to 'model/policy-model/src/main/java')
2 files changed, 14 insertions, 7 deletions
diff --git a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxLogic.java b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxLogic.java index 99642d1ae..ad86fb42c 100644 --- a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxLogic.java +++ b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxLogic.java @@ -271,11 +271,11 @@ public class AxLogic extends AxConcept { "logic flavour is not defined")); } - try { - Assertions.validateStringParameter(LOGIC_FLAVOUR_TOKEN, logicFlavour, LOGIC_FLAVOUR_REGEXP); - } catch (final IllegalArgumentException e) { + String flavourValidationString = Assertions.getStringParameterValidationMessage(LOGIC_FLAVOUR_TOKEN, + logicFlavour, LOGIC_FLAVOUR_REGEXP); + if (flavourValidationString != null) { result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, - "logic flavour invalid-" + e.getMessage())); + "logic flavour invalid-" + flavourValidationString)); } if (logic.replaceAll(WHITESPACE_REGEXP, "").length() == 0) { diff --git a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxPolicy.java b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxPolicy.java index a03b49f13..3c43c6edd 100644 --- a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxPolicy.java +++ b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxPolicy.java @@ -49,6 +49,8 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxValidationMessage; import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult; import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult.ValidationResult; import org.onap.policy.apex.model.utilities.Assertions; +import org.slf4j.ext.XLogger; +import org.slf4j.ext.XLoggerFactory; /** * This class holds the definition of an Apex policy. A policy is made up of a tree of states, each represented by an @@ -88,6 +90,9 @@ import org.onap.policy.apex.model.utilities.Assertions; public class AxPolicy extends AxConcept { private static final long serialVersionUID = -1775614096390365941L; + // Logger for this class + private static final XLogger LOGGER = XLoggerFactory.getXLogger(AxPolicy.class); + @EmbeddedId @XmlElement(name = "policyKey", required = true) private AxArtifactKey key; @@ -364,7 +369,7 @@ public class AxPolicy extends AxConcept { */ private AxValidationResult validateStateTree(AxValidationResult result) { try { - // Cpnstructor validates policy state tree + // Constructor validates policy state tree AxStateTree policyStateTree = getStateTree(); // Check for unused states @@ -378,8 +383,10 @@ public class AxPolicy extends AxConcept { + " is not referenced in the policy execution tree")); } } catch (PolicyRuntimeException pre) { - result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.WARNING, - "state tree in policy is invalid")); + AxValidationMessage validationMessage = new AxValidationMessage(key, this.getClass(), + ValidationResult.WARNING, "state tree in policy is invalid"); + LOGGER.trace(validationMessage.getMessage(), pre); + result.addValidationMessage(validationMessage); } return result; |