From 6897272aefdaa9d070c162991cbb6154c2be79b3 Mon Sep 17 00:00:00 2001 From: rama-huawei Date: Fri, 15 Sep 2017 18:03:48 +0530 Subject: Fix for sonar critical issues DCAEGEN2-93 Change-Id: I06993bfcc5b4013326f7c8c72bd4f3c38c84f0fd Signed-off-by: rama-huawei --- src/main/java/com/att/nsa/mr/tools/TopicCommand.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/att/nsa/mr/tools/TopicCommand.java b/src/main/java/com/att/nsa/mr/tools/TopicCommand.java index 8010a58..4b1151e 100644 --- a/src/main/java/com/att/nsa/mr/tools/TopicCommand.java +++ b/src/main/java/com/att/nsa/mr/tools/TopicCommand.java @@ -25,6 +25,9 @@ import java.io.IOException; import java.io.PrintStream; import java.util.Set; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import com.att.nsa.apiClient.http.HttpException; import com.att.nsa.apiClient.http.HttpObjectNotFoundException; import com.att.nsa.cmdtool.Command; @@ -35,7 +38,7 @@ import com.att.nsa.mr.client.MRTopicManager.TopicInfo; public class TopicCommand implements Command { - + final Logger logger = LoggerFactory.getLogger(ApiKeyCommand.class); @Override public String[] getMatches () { @@ -117,10 +120,12 @@ public class TopicCommand implements Command catch ( IOException x ) { out.println ( "Problem with request: " + x.getMessage () ); + logger.error("IOException: ", x); } catch ( HttpObjectNotFoundException e ) { out.println ( "Not found: " + e.getMessage () ); + logger.error("HttpObjectNotFoundException: ", e); } } else if ( parts[0].equals ( "create" ) ) @@ -135,14 +140,17 @@ public class TopicCommand implements Command catch ( HttpException e ) { out.println ( "Problem with request: " + e.getMessage () ); + logger.error("HttpException: ", e); } catch ( IOException e ) { out.println ( "Problem with request: " + e.getMessage () ); + logger.error("IOException: ", e); } catch ( NumberFormatException e ) { out.println ( "Problem with request: " + e.getMessage () ); + logger.error("NumberFormatException: ", e); } } else if ( parts[0].equals ( "grant" ) ) @@ -161,10 +169,12 @@ public class TopicCommand implements Command catch ( HttpException e ) { out.println ( "Problem with request: " + e.getMessage () ); + logger.error("HttpException: ", e); } catch ( IOException e ) { out.println ( "Problem with request: " + e.getMessage () ); + logger.error("IOException: ", e); } } else if ( parts[0].equals ( "revoke" ) ) @@ -183,10 +193,12 @@ public class TopicCommand implements Command catch ( HttpException e ) { out.println ( "Problem with request: " + e.getMessage () ); + logger.error("HttpException: ", e); } catch ( IOException e ) { out.println ( "Problem with request: " + e.getMessage () ); + logger.error("IOException: ", e); } } } -- cgit 1.2.3-korg