diff options
author | Pamela Dragosh <pdragosh@research.att.com> | 2019-09-13 12:12:45 -0400 |
---|---|---|
committer | Pamela Dragosh <pdragosh@research.att.com> | 2019-09-13 16:07:44 -0400 |
commit | 8d54e1d7e53651432932e286f8831f0b4db1f22a (patch) | |
tree | 76d7a648930d8e2c2f09ece25953f6756cc31108 /applications/common/src/main | |
parent | 1df1c6aeb21b50ab5c4f7c4a7e6da7bc8abed62e (diff) |
Upgrade to Tosca derivedFrom fix
Upgrade to models fix for derivedFrom() append of 0.0.0
And some sonar fixes for:
Exceptions should be either logged or rethrown but not both
Preconditions" and logging arguments should not require evaluation
Reduced cognitive complexity
Issue-ID: POLICY-2079
Change-Id: Ied8630020e8a737c33b1484db953df133c89398f
Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
Diffstat (limited to 'applications/common/src/main')
3 files changed, 4 insertions, 11 deletions
diff --git a/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdCombinedPolicyResultsTranslator.java b/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdCombinedPolicyResultsTranslator.java index bd10fb2e..12337d20 100644 --- a/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdCombinedPolicyResultsTranslator.java +++ b/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdCombinedPolicyResultsTranslator.java @@ -112,7 +112,6 @@ public class StdCombinedPolicyResultsTranslator implements ToscaPolicyTranslator try { jsonPolicy = coder.encode(toscaPolicy); } catch (CoderException e) { - LOGGER.error("Failed to encode policy to json", e); throw new ToscaPolicyConversionException(e); } addObligation(rule, jsonPolicy); diff --git a/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdMatchableTranslator.java b/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdMatchableTranslator.java index 0575ef1b..7142d43d 100644 --- a/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdMatchableTranslator.java +++ b/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdMatchableTranslator.java @@ -469,14 +469,8 @@ public class StdMatchableTranslator implements ToscaPolicyTranslator { // // Or do we assume 1.0.0? // - String strDerivedFrom = childPolicyType.getDerivedFrom(); - // - // Hack that fixes policy/models appending 0.0.0 to the derivedFrom name - // - if (strDerivedFrom.endsWith("0.0.0")) { - strDerivedFrom = strDerivedFrom.substring(0, strDerivedFrom.length() - "0.0.0".length() - 1); - } - ToscaPolicyTypeIdentifier parentId = new ToscaPolicyTypeIdentifier(strDerivedFrom, "1.0.0"); + ToscaPolicyTypeIdentifier parentId = new ToscaPolicyTypeIdentifier(childPolicyType.getDerivedFrom(), + "1.0.0"); // // Find the policy type // diff --git a/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdOnapPip.java b/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdOnapPip.java index c511a9ad..69838599 100644 --- a/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdOnapPip.java +++ b/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdOnapPip.java @@ -105,12 +105,12 @@ public abstract class StdOnapPip extends StdConfigurableEngine { try { pipResponse = pipFinder.getMatchingAttributes(pipRequest, this); if (pipResponse.getStatus() != null && !pipResponse.getStatus().isOk()) { - logger.info("get attribute error retrieving {}: {}", pipRequest.getAttributeId().stringValue(), + logger.info("get attribute error retrieving {}: {}", pipRequest.getAttributeId(), pipResponse.getStatus()); pipResponse = null; } if (pipResponse != null && pipResponse.getAttributes().isEmpty()) { - logger.info("No value for {}", pipRequest.getAttributeId().stringValue()); + logger.info("No value for {}", pipRequest.getAttributeId()); pipResponse = null; } } catch (PIPException ex) { |