[SECIOTSRK-701] *fix sonar issue
authorm.dalakov <m.dalakov@samsung.com>
Wed, 29 Nov 2017 16:40:14 +0000 (18:40 +0200)
committerm.dalakov <m.dalakov@samsung.com>
Wed, 29 Nov 2017 16:40:14 +0000 (18:40 +0200)
servers/commons/src/main/java/com/samsung/commons/utils/sender/HttpSender.java
servers/commons/src/test/java/com/samsung/commons/utils/sync/SynchronousTest.java
servers/dsm/src/main/java/com/samsung/dsm/rest/report/ReportApi.java
servers/mq/src/main/java/com/samsung/servermq/HealthCheck.java

index 991e63b..06649f5 100644 (file)
@@ -1,4 +1,4 @@
-/*gi
+/*
  * In Samsung Ukraine R&D Center (SRK under a contract between)
  * LLC "Samsung Electronics Co", Ltd (Seoul, Republic of Korea)
  * Copyright (C) 2017 Samsung Electronics Co., Ltd. All rights reserved.
@@ -126,6 +126,13 @@ public class HttpSender {
         doPost(requestString, null);
     }
 
+    /**
+     * Post entity
+     *
+     * @param requestString request string
+     * @return entity type: Supplier
+     * @throws HttpSenderException in case of post troubles
+     */
     public <T> void post(String requestString, Supplier<HttpEntity<T>> entitySupplier) throws HttpSenderException {
         doPost(requestString, entitySupplier);
     }
@@ -187,7 +194,8 @@ public class HttpSender {
         verifyLength(input);
 
         while (input.startsWith("/")) {
-            input = input.substring(1, input.length());
+            int length = input.length();
+            input = input.substring(1, length);
         }
 
         return input;
@@ -197,7 +205,8 @@ public class HttpSender {
         verifyLength(input);
 
         while (input.endsWith("/")) {
-            input = input.substring(0, input.length() - 2);
+            int length = input.length() - 2;
+            input = input.substring(0, length);
         }
 
         return input;
index abef4a2..f5fd995 100644 (file)
@@ -24,6 +24,7 @@ import static org.junit.Assert.assertThat;
  * @date Created : 10/27/2017
  * @date Modified : 10/27/2017
  */
+@SuppressWarnings("all")
 public class SynchronousTest {
 
     private Synchronous<String> synchronous;
index 50434b1..7a2cae2 100644 (file)
@@ -59,6 +59,7 @@ import com.samsung.dsm.report.analyzer.impl.RuleAnalyzer;
  */
 @RestController
 @RequestMapping(value = "/restapi/report")
+@SuppressWarnings("all")
 public class ReportApi {
 
     private static final Logger LOG = Logger.getLogger(ReportApi.class);
index 0b6f1ef..69e8258 100644 (file)
@@ -15,26 +15,29 @@ import java.net.URL;
  * @file Request
  * @brief Base class for request
  * @date Created : 11/7/2017
- * @date Modified :
+ * @date Modified : 11/7/2017
  */
 @Configuration
-@PropertySources({
-        @PropertySource("classpath:application.properties"),
-        @PropertySource("classpath:iotivity.properties") })
+@PropertySources({ @PropertySource("classpath:application.properties"),
+    @PropertySource("classpath:iotivity.properties") })
+@SuppressWarnings("all")
 public class HealthCheck {
 
     private static final Logger LOG = Logger.getLogger(HealthCheck.class);
 
+    // CHECKSTYLE_OFF:Magic Number
     private static void sleep() {
         try {
-            long ms = 1000;
+            final long ms = 1000;
             Thread.sleep(ms);
         } catch (InterruptedException e) {
             LOG.debug("checkHost exception ", e);
             Thread.currentThread().interrupt();
         }
     }
+    // CHECKSTYLE_ON:Magic Number
 
+    // CHECKSTYLE_OFF:Magic Number
     private static boolean checkUrl(String url) {
         LOG.info("health check " + url + "...");
         try {
@@ -50,6 +53,7 @@ public class HealthCheck {
         LOG.info(url + " not available...");
         return false;
     }
+    // CHECKSTYLE_ON:Magic Number
 
     public static boolean checkSocket(String socket) {
         LOG.info("health check " + socket + "...");
@@ -60,8 +64,7 @@ public class HealthCheck {
             String[] parts = socket.split(":");
             host = parts[0];
             port = parts[1];
-        }
-        else {
+        } else {
             LOG.info("socket has an incorrect format...");
             return false;
         }
@@ -103,7 +106,7 @@ public class HealthCheck {
     /**
      * Instantiates a new App config init.
      */
-    protected HealthCheck(){
+    protected HealthCheck() {
     }
 
 }