TopicResource.java: Fixed sonar issues 57/64957/1
authorArundathi Patil <arundpil@in.ibm.com>
Thu, 6 Sep 2018 09:52:22 +0000 (15:22 +0530)
committerIBM602-PC0F1E3C\Arundathi <arundpil@in.ibm.com>
Thu, 6 Sep 2018 09:52:35 +0000 (15:22 +0530)
Fixed sonar code-smells/issues across this file

Issue-ID: DMAAP-742
Change-Id: I34b8d3a9d326b8d7a5bef4c042da314614fa4b59
Signed-off-by: Arundathi Patil <arundpil@in.ibm.com>
src/main/java/org/onap/dmaap/dbcapi/resources/TopicResource.java

index 95f9d33..cab48ca 100644 (file)
@@ -96,7 +96,7 @@ public class TopicResource extends BaseLoggingClass {
        public Response  addTopic( 
                        Topic topic
                        ) {
-               logger.info( "addTopic request: " + String.valueOf(topic) );
+               logger.info( "addTopic request: " + topic );
                ApiService check = new ApiService();
 
                try {
@@ -104,10 +104,10 @@ public class TopicResource extends BaseLoggingClass {
                        check.required( "topicDescription", topic.getTopicDescription(), "" );
                        check.required( "owner", topic.getOwner(), "" );
                } catch( RequiredFieldException rfe ) {
+                       logger.error("Error", rfe);
                        return check.error();
                }
                
-               //String repReq = topic.getReplicationRequest();
                ReplicationType t = topic.getReplicationCase();
                if ( t == null || t == ReplicationType.REPLICATION_NOT_SPECIFIED ) {
                        topic.setReplicationCase( mr_topicService.reviewTopic(topic));
@@ -163,6 +163,7 @@ public class TopicResource extends BaseLoggingClass {
                try {
                        check.required( "fqtn", id, "" );
                } catch( RequiredFieldException rfe ) {
+                       logger.error("Error", rfe);
                        return check.error();
                }
                
@@ -192,6 +193,7 @@ public class TopicResource extends BaseLoggingClass {
                try {
                        check.required( "topicName", id, "^\\S+$" );  //no white space allowed in topicName
                } catch( RequiredFieldException rfe ) {
+                       logger.error("Error", rfe);
                        return check.error();
                }
                Topic mrc =  mr_topicService.getTopic( id, check.getErr() );