From a9692dd1ffe49fe5835fc8c27838338d13fd66f2 Mon Sep 17 00:00:00 2001 From: rama-huawei Date: Fri, 15 Sep 2017 10:54:34 +0530 Subject: Fix for sonar critical issues DCAEGEN2-93 Change-Id: I7e0dbcaf811bf0e9ee8389579abbb7b107fcd136 Signed-off-by: rama-huawei --- src/main/java/com/att/nsa/mr/tools/ApiKeyCommand.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/main/java/com/att/nsa/mr/tools') diff --git a/src/main/java/com/att/nsa/mr/tools/ApiKeyCommand.java b/src/main/java/com/att/nsa/mr/tools/ApiKeyCommand.java index 0faefe7..df28fc0 100644 --- a/src/main/java/com/att/nsa/mr/tools/ApiKeyCommand.java +++ b/src/main/java/com/att/nsa/mr/tools/ApiKeyCommand.java @@ -24,6 +24,9 @@ package com.att.nsa.mr.tools; import java.io.IOException; import java.io.PrintStream; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import com.att.nsa.apiClient.credentials.ApiCredential; import com.att.nsa.apiClient.http.HttpException; import com.att.nsa.apiClient.http.HttpObjectNotFoundException; @@ -36,7 +39,7 @@ import com.att.nsa.mr.client.MRIdentityManager.ApiKey; public class ApiKeyCommand implements Command { - + final Logger log = LoggerFactory.getLogger(ApiKeyCommand.class); @Override public String[] getMatches () { @@ -104,18 +107,22 @@ public class ApiKeyCommand implements Command catch ( HttpObjectNotFoundException e ) { out.println ( "Object not found: " + e.getMessage () ); + log.error("HttpObjectNotFoundException: ", e); } catch ( HttpException e ) { out.println ( "HTTP exception: " + e.getMessage () ); + log.error("HttpException: ", e); } catch ( MRApiException e ) { out.println ( "API exception: " + e.getMessage () ); + log.error("MRApiException: ", e); } catch ( IOException e ) { out.println ( "IO exception: " + e.getMessage () ); + log.error("IOException: ", e); } finally { -- cgit 1.2.3-korg