Fix sonar logging bugs 18/103518/2
authorPamela Dragosh <pdragosh@research.att.com>
Wed, 11 Mar 2020 14:35:04 +0000 (10:35 -0400)
committerPamela Dragosh <pdragosh@research.att.com>
Wed, 11 Mar 2020 14:39:11 +0000 (10:39 -0400)
These did not show up locally - sonarqube must have a new
version or rules to pick these up.

Issue-ID: POLICY-2242
Change-Id: I3df5aee84f696cde6b07c68913bbd55e95c8ba3b
Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/OnapPolicyFinderFactory.java
applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdCombinedPolicyResultsTranslator.java
applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdMatchablePolicyRequest.java
applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdMatchableTranslator.java
applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdOnapPip.java
applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdXacmlApplicationServiceProvider.java
applications/guard/src/main/java/org/onap/policy/xacml/pdp/application/guard/GuardTranslator.java
applications/optimization/src/main/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationPdpApplication.java

index e12f9f7..b000db9 100644 (file)
@@ -138,7 +138,7 @@ public class OnapPolicyFinderFactory extends PolicyFinderFactory {
             }
             return new Policy(StdStatusCode.STATUS_CODE_SYNTAX_ERROR, "DOM Could not load policy");
         } catch (DOMStructureException ex) {
-            logger.error("Error loading policy file {}: {}", fileLocation.getAbsolutePath(), ex);
+            logger.error("Error loading policy file {}", fileLocation.getAbsolutePath(), ex);
             return new Policy(StdStatusCode.STATUS_CODE_SYNTAX_ERROR, ex.getMessage());
         }
     }
index 0a1ace2..aba5e25 100644 (file)
@@ -132,7 +132,7 @@ public class StdCombinedPolicyResultsTranslator extends StdBaseTranslator {
         try {
             return RequestParser.parseRequest(StdCombinedPolicyRequest.createInstance(request));
         } catch (IllegalArgumentException | IllegalAccessException | DataTypeException e) {
-            LOGGER.error("Failed to convert DecisionRequest: {}", e);
+            LOGGER.error("Failed to convert DecisionRequest", e);
         }
         //
         // TODO throw exception
index 2cb8294..d0ae524 100644 (file)
@@ -86,7 +86,7 @@ public class StdMatchablePolicyRequest {
             }
             dataTypeFactory = DataTypeFactory.newInstance();
         } catch (FactoryException e) {
-            LOGGER.error("Can't get Data type Factory: {}", e);
+            LOGGER.error("Can't get Data type Factory", e);
         }
         return dataTypeFactory;
     }
index e84a9e7..d5e2a39 100644 (file)
@@ -105,7 +105,7 @@ public class StdMatchableTranslator  extends StdBaseTranslator {
         try {
             return StdMatchablePolicyRequest.createInstance(request);
         } catch (XacmlApplicationException e) {
-            LOGGER.error("Failed to convert DecisionRequest: {}", e);
+            LOGGER.error("Failed to convert DecisionRequest", e);
         }
         //
         // TODO throw exception
index 4ef71b3..ca07f22 100644 (file)
@@ -110,7 +110,7 @@ public abstract class StdOnapPip extends StdConfigurableEngine {
                     properties.getProperty(this.issuer + ".persistenceunit"),
                     emProperties).createEntityManager();
         } catch (Exception e) {
-            logger.error("Persistence failed {} operations history db {}", e.getLocalizedMessage(), e);
+            logger.error("Persistence failed {} operations history db", e.getLocalizedMessage(), e);
         }
     }
 
@@ -143,7 +143,7 @@ public abstract class StdOnapPip extends StdConfigurableEngine {
                 pipResponse = null;
             }
         } catch (PIPException ex) {
-            logger.error("PIPException getting subject-id attribute: " + ex.getMessage(), ex);
+            logger.error("PIPException getting subject-id attribute", ex);
         }
         return pipResponse;
     }
@@ -167,7 +167,7 @@ public abstract class StdOnapPip extends StdConfigurableEngine {
         try {
             attributeValue  = makeInteger(value);
         } catch (Exception e) {
-            logger.error("Failed to convert {} to integer {}", value, e);
+            logger.error("Failed to convert {} to integer", value, e);
         }
         if (attributeValue != null) {
             stdPipResponse.addAttribute(new StdMutableAttribute(category, attributeId, attributeValue,
@@ -181,7 +181,7 @@ public abstract class StdOnapPip extends StdConfigurableEngine {
         try {
             attributeValue  = makeLong(value);
         } catch (Exception e) {
-            logger.error("Failed to convert {} to long {}", value, e);
+            logger.error("Failed to convert {} to long", value, e);
         }
         if (attributeValue != null) {
             stdPipResponse.addAttribute(new StdMutableAttribute(category, attributeId, attributeValue,
index e43e651..1127165 100644 (file)
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP
  * ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -194,7 +194,7 @@ public abstract class StdXacmlApplicationServiceProvider implements XacmlApplica
             Files.delete(refPolicy);
         } catch (IOException e) {
             LOGGER.error("Failed to delete policy {} from disk {}", toscaPolicy.getMetadata(),
-                    refPolicy.toAbsolutePath().toString(), e);
+                    refPolicy.toAbsolutePath(), e);
         }
         //
         // Write the properties to disk
@@ -277,7 +277,7 @@ public abstract class StdXacmlApplicationServiceProvider implements XacmlApplica
                 this.pdpEngine = engine;
             }
         } catch (FactoryException e) {
-            LOGGER.error("Failed to create XACML PDP Engine {}", e);
+            LOGGER.error("Failed to create XACML PDP Engine", e);
         }
     }
 
@@ -299,7 +299,7 @@ public abstract class StdXacmlApplicationServiceProvider implements XacmlApplica
         try {
             response = this.pdpEngine.decide(request);
         } catch (PDPException e) {
-            LOGGER.error("Xacml PDP Engine failed {}", e);
+            LOGGER.error("Xacml PDP Engine decide failed", e);
         } finally {
             //
             // Track the end of timing
index ebcae8d..4365cad 100644 (file)
@@ -145,7 +145,7 @@ public class GuardTranslator implements ToscaPolicyTranslator {
         try {
             return RequestParser.parseRequest(GuardPolicyRequest.createInstance(request));
         } catch (IllegalArgumentException | IllegalAccessException | DataTypeException e) {
-            LOGGER.error("Failed to convert DecisionRequest: {}", e);
+            LOGGER.error("Failed to convert DecisionRequest", e);
         }
         //
         // TODO throw exception
index d0f4b1e..ee1ccdc 100644 (file)
@@ -165,7 +165,7 @@ public class OptimizationPdpApplication extends StdXacmlApplicationServiceProvid
                 xacmlSubscriberResponse =
                         this.xacmlDecision(OptimizationSubscriberRequest.createInstance(subscriberRequest));
             } catch (XacmlApplicationException e) {
-                LOGGER.error("Could not create subscriberName request {}", e);
+                LOGGER.error("Could not create subscriberName request", e);
             }
             //
             // Check the response for subscriber attributes and add them