aboutsummaryrefslogtreecommitdiffstats
path: root/model/policy-model/src/main/java
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@ericsson.com>2018-09-12 23:29:25 +0100
committerliamfallon <liam.fallon@ericsson.com>2018-09-12 23:54:51 +0100
commit0e23f7634e1e1fb31454c516974613335fcea1a4 (patch)
treebedf0e52104e62599dd091eb6292de5dc7d57f49 /model/policy-model/src/main/java
parent3ccc3d9ecd4bcd8960a2da6ecbdc7f3ac806fc67 (diff)
Sonar/Checkstyle in model/context/core
Checkstyle and sonar changes in the model, contexot and core modules. Issue-ID: POLICY-1034 Change-Id: I2d40bc877f3a548844470fc290fc89d63fa465ae Signed-off-by: liamfallon <liam.fallon@ericsson.com>
Diffstat (limited to 'model/policy-model/src/main/java')
-rw-r--r--model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/handling/PolicyLogicReader.java5
-rw-r--r--model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/handling/PolicyModelMerger.java12
-rw-r--r--model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/handling/PolicyModelSplitter.java7
3 files changed, 14 insertions, 10 deletions
diff --git a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/handling/PolicyLogicReader.java b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/handling/PolicyLogicReader.java
index 822a803bf..aa57be552 100644
--- a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/handling/PolicyLogicReader.java
+++ b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/handling/PolicyLogicReader.java
@@ -143,8 +143,9 @@ public class PolicyLogicReader implements AxLogicReader {
// Check if the logic was found
if (logicString == null || logicString.length() == 0) {
- LOGGER.warn("logic not found for logic \"" + fullLogicFilePath + "\"");
- throw new PolicyRuntimeException("logic not found for logic \"" + fullLogicFilePath + "\"");
+ String errorMessage = "logic not found for logic \"" + fullLogicFilePath + "\"";
+ LOGGER.warn(errorMessage);
+ throw new PolicyRuntimeException(errorMessage);
}
// Return the right trimmed logic string
diff --git a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/handling/PolicyModelMerger.java b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/handling/PolicyModelMerger.java
index 091f20462..28133cefa 100644
--- a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/handling/PolicyModelMerger.java
+++ b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/handling/PolicyModelMerger.java
@@ -80,8 +80,9 @@ public final class PolicyModelMerger {
final AxValidationResult leftValidationResult = new AxValidationResult();
leftPolicyModel.validate(leftValidationResult);
if (!leftValidationResult.isValid()) {
- LOGGER.warn("left model is invalid: " + leftValidationResult.toString());
- throw new ApexModelException("left model is invalid: " + leftValidationResult.toString());
+ String message = "left model is invalid: " + leftValidationResult.toString();
+ LOGGER.warn(message);
+ throw new ApexModelException(message);
}
}
@@ -90,13 +91,14 @@ public final class PolicyModelMerger {
final AxValidationResult rightValidationResult = new AxValidationResult();
rightPolicyModel.validate(rightValidationResult);
if (!rightValidationResult.isValid()) {
- LOGGER.warn("right model is invalid: " + rightValidationResult.toString());
- throw new ApexModelException("right model is invalid: " + rightValidationResult.toString());
+ String message = "right model is invalid: " + rightValidationResult.toString();
+ LOGGER.warn(message);
+ throw new ApexModelException(message);
}
}
// The new policy model uses the favoured copy side as its base
- final AxPolicyModel mergedPolicyModel = (AxPolicyModel) (useLeftOnMatches ? new AxPolicyModel(leftPolicyModel)
+ final AxPolicyModel mergedPolicyModel = (useLeftOnMatches ? new AxPolicyModel(leftPolicyModel)
: new AxPolicyModel(rightPolicyModel));
// The Compared to policy model is the unfavoured side
diff --git a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/handling/PolicyModelSplitter.java b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/handling/PolicyModelSplitter.java
index 586d0706e..7ecb8fb0f 100644
--- a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/handling/PolicyModelSplitter.java
+++ b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/handling/PolicyModelSplitter.java
@@ -77,8 +77,9 @@ public final class PolicyModelSplitter {
final AxValidationResult sourceValidationResult = new AxValidationResult();
sourcePolicyModel.validate(sourceValidationResult);
if (!sourceValidationResult.isValid()) {
- LOGGER.warn("source model is invalid: " + sourceValidationResult.toString());
- throw new ApexModelException("source model is invalid: " + sourceValidationResult.toString());
+ String message = "source model is invalid: " + sourceValidationResult.toString();
+ LOGGER.warn(message);
+ throw new ApexModelException(message);
}
}
@@ -103,7 +104,7 @@ public final class PolicyModelSplitter {
for (final AxArtifactKey subPolicyKey : subPolicies) {
final AxPolicy subPolicy = sourcePolicyModel.getPolicies().getPolicyMap().get(subPolicyKey);
if (subPolicy == null) {
- LOGGER.warn("source sub policy not found: " + subPolicyKey);
+ LOGGER.warn("source sub policy not found: {}", subPolicyKey);
continue;
}