summaryrefslogtreecommitdiffstats
path: root/controlloop/common
diff options
context:
space:
mode:
authorMike Babinski <mb1915@att.com>2017-08-25 20:56:10 +0000
committerMike Babinski <mb1915@att.com>2017-08-25 21:21:35 +0000
commitd03507850e293674cc118f76bab0629d457179ae (patch)
tree83ac8036c99be994e18d0121ea297ebaf43d6f88 /controlloop/common
parent1c4fcf40b4cd33454bb57bde1e82a3819cb6ccff (diff)
Fix Sonar Blocker for Drools-Applications
Add only the null check for pipResponse. Issue-ID: POLICY-111 Change-Id: I2721c759f27264ce164110a19ea8c649b74869df Signed-off-by: Mike Babinski <mb1915@att.com>
Diffstat (limited to 'controlloop/common')
-rw-r--r--controlloop/common/guard/src/main/java/org/onap/policy/guard/PIPEngineGetHistory.java28
1 files changed, 16 insertions, 12 deletions
diff --git a/controlloop/common/guard/src/main/java/org/onap/policy/guard/PIPEngineGetHistory.java b/controlloop/common/guard/src/main/java/org/onap/policy/guard/PIPEngineGetHistory.java
index 30f1ef820..67ac170db 100644
--- a/controlloop/common/guard/src/main/java/org/onap/policy/guard/PIPEngineGetHistory.java
+++ b/controlloop/common/guard/src/main/java/org/onap/policy/guard/PIPEngineGetHistory.java
@@ -126,13 +126,16 @@ public class PIPEngineGetHistory extends StdConfigurableEngine{
*/
String string;
if ((string = pipRequest.getIssuer()) == null) {
+
logger.debug("No issuer in the request...");
+ logger.debug("FeqLimiter PIP - No issuer in the request!");
return StdPIPResponse.PIP_RESPONSE_EMPTY;
}
else{
//Notice, we are checking here for the base issuer prefix.
if (!string.contains(this.getIssuer())) {
- logger.debug("Requested issuer '" + string + "' does not match " + (this.getIssuer() == null ? "null" : "'" + this.getIssuer() + "'"));
+ logger.debug("Requested issuer '{}' does not match {}", string, (this.getIssuer() == null ? "null" : "'" + this.getIssuer() + "'"));
+ logger.debug("FeqLimiter PIP - Issuer {} does not match with: ", string, this.getIssuer());
return StdPIPResponse.PIP_RESPONSE_EMPTY;
}
}
@@ -148,7 +151,7 @@ public class PIPEngineGetHistory extends StdConfigurableEngine{
String timeWindow = timeWindowVal + " " + timeWindowScale;
- logger.debug("Going to query DB about: "+actor + " " + operation + " " + target + " " + timeWindow);
+ logger.debug("Going to query DB about: {} {} {} {}", actor, operation, target, timeWindow);
int countFromDB = getCountFromDB(actor, operation, target, timeWindow);
StdMutablePIPResponse stdPIPResponse = new StdMutablePIPResponse();
@@ -182,16 +185,18 @@ public class PIPEngineGetHistory extends StdConfigurableEngine{
try {
pipResponse = pipFinder.getMatchingAttributes(pipRequest, this);
- if (pipResponse.getStatus() != null && !pipResponse.getStatus().isOk()) {
- logger.debug("Error retrieving " + pipRequest.getAttributeId().stringValue() + ": " + pipResponse.getStatus().toString());
- pipResponse = null;
- }
- if (pipResponse.getAttributes() != null && pipResponse.getAttributes().isEmpty()) {
- logger.debug("No value for {}", pipRequest.getAttributeId().stringValue());
- pipResponse = null;
+ if (pipResponse != null) {
+ if (pipResponse.getStatus() != null && !pipResponse.getStatus().isOk()) {
+ logger.debug("Error retrieving {}: {}", pipRequest.getAttributeId().stringValue(), pipResponse.getStatus().toString());
+ pipResponse = null;
+ }
+ if (pipResponse.getAttributes() != null && pipResponse.getAttributes().isEmpty()) {
+ logger.debug("Error retrieving {}: {}", pipRequest.getAttributeId().stringValue(), pipResponse.getStatus().toString());
+ pipResponse = null;
+ }
}
} catch (PIPException ex) {
- logger.error("getAttribute threw: ", ex);
+ logger.error("getAttribute threw:", ex);
}
return pipResponse;
}
@@ -316,7 +321,6 @@ public class PIPEngineGetHistory extends StdConfigurableEngine{
return -1;
}
-
em.close();
return ret;
@@ -324,4 +328,4 @@ public class PIPEngineGetHistory extends StdConfigurableEngine{
}
-}
+} \ No newline at end of file