diff options
author | Magnusen, Drew (dm741q) <dm741q@att.com> | 2017-08-16 15:21:15 -0500 |
---|---|---|
committer | Magnusen, Drew (dm741q) <dm741q@att.com> | 2017-08-18 14:40:18 -0500 |
commit | 6d7e231986b84cf6646e46beba7e7e05699bffe6 (patch) | |
tree | e08ebda96bc5797d64dd66e667303cf55ad87491 /controlloop/common/model-impl/rest/src/main/java/org | |
parent | 5ae90a9bf72d2d6dbb163c3dbea5474b657be7e7 (diff) |
Code cleanup to resolve critical sonar issues
Code cleanup mostly involed directing the output of exception messages
to the correct logger stream.
Issue-ID: [POLICY-115]
Change-Id: I2042bac3d3b0991a2ebed33421a73f1aa300c7c1
Signed-off-by: Magnusen, Drew (dm741q) <dm741q@att.com>
Diffstat (limited to 'controlloop/common/model-impl/rest/src/main/java/org')
-rw-r--r-- | controlloop/common/model-impl/rest/src/main/java/org/onap/policy/rest/RESTManager.java | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/controlloop/common/model-impl/rest/src/main/java/org/onap/policy/rest/RESTManager.java b/controlloop/common/model-impl/rest/src/main/java/org/onap/policy/rest/RESTManager.java index e42ab1693..8c79d2ad3 100644 --- a/controlloop/common/model-impl/rest/src/main/java/org/onap/policy/rest/RESTManager.java +++ b/controlloop/common/model-impl/rest/src/main/java/org/onap/policy/rest/RESTManager.java @@ -34,9 +34,13 @@ import org.apache.http.impl.client.BasicCredentialsProvider; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.util.EntityUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public final class RESTManager { + private static final Logger logger = LoggerFactory.getLogger(RESTManager.class); + public static class Pair<A, B> { public final A a; public final B b; @@ -81,7 +85,8 @@ public final class RESTManager { return new Pair<Integer, String>(response.getStatusLine().getStatusCode(), returnBody); } catch (IOException e) { - System.err.println("Failed to POST to " + url + e.getLocalizedMessage()); + logger.error("Failed to POST to {}",url,e); + return null; } @@ -108,7 +113,7 @@ public final class RESTManager { return new Pair<Integer, String>(response.getStatusLine().getStatusCode(), returnBody); } catch (IOException e) { - System.err.println("Failed to GET to " + url + e.getLocalizedMessage()); + logger.error("Failed to GET to {}",url,e); return null; } } |