]> source.dussan.org Git - sonarqube.git/commitdiff
fix quality flaw
authorStephane Gamard <stephane.gamard@searchbox.com>
Thu, 14 Aug 2014 11:08:51 +0000 (13:08 +0200)
committerStephane Gamard <stephane.gamard@searchbox.com>
Thu, 14 Aug 2014 11:08:51 +0000 (13:08 +0200)
server/process/sonar-process/src/main/java/org/sonar/process/NetworkUtils.java
server/process/sonar-process/src/main/java/org/sonar/process/ProcessUtils.java
server/process/sonar-process/src/main/java/org/sonar/process/ProcessWrapper.java
server/sonar-search/src/main/java/org/sonar/search/SearchServer.java

index a037ce0113a048955d37ec5e43abe594c178404c..516c57c497ad3118a88ea855bf1da0aee788df26 100644 (file)
@@ -24,6 +24,10 @@ import java.net.ServerSocket;
 
 public class NetworkUtils {
 
+  private NetworkUtils() {
+    // only static stuff
+  }
+
   public static int freePort() {
     try {
       ServerSocket s = new ServerSocket(0);
index 92537412587831da3510ce27b0a24da1544a0191..a762446ec872584253eab3f1399334045f974d6b 100644 (file)
 package org.sonar.process;
 
 import org.apache.commons.io.IOUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import javax.annotation.Nullable;
 
 public class ProcessUtils {
+
+  private static final Logger LOGGER = LoggerFactory.getLogger(ProcessUtils.class);
+
   private ProcessUtils() {
     // only static stuff
   }
@@ -36,6 +41,7 @@ public class ProcessUtils {
       process.exitValue();
       return false;
     } catch (IllegalThreadStateException e) {
+      LOGGER.trace("Process has no exit value yet", e);
       return true;
     }
   }
@@ -45,7 +51,7 @@ public class ProcessUtils {
       try {
         process.destroy();
       } catch (Exception ignored) {
-        // ignored
+        LOGGER.warn("Exception while destroying the process", ignored);
       }
     }
   }
index 3eca9804a7c8a2c77121d64ec4c982360abd779f..c3c9949efc19ec52e8cc6dd79924ea08ae3eca45 100644 (file)
@@ -360,7 +360,7 @@ public class ProcessWrapper extends Thread implements Terminable {
           logger.info(line);
         }
       } catch (Exception ignored) {
-        LOGGER.trace("Error while Gobbling", ignored);
+        logger.trace("Error while Gobbling", ignored);
       } finally {
         IOUtils.closeQuietly(br);
         IOUtils.closeQuietly(isr);
index 960ce34b272876d74f19521b576218b253adf2c9..14d28abd45c08911c02627c88b361c6d87393267 100644 (file)
@@ -76,11 +76,11 @@ public class SearchServer extends MonitoredProcess {
 
   @Override
   protected boolean doIsReady() {
-    return (node.client().admin().cluster().prepareHealth()
+    return node.client().admin().cluster().prepareHealth()
       .setWaitForYellowStatus()
       .setTimeout(TimeValue.timeValueSeconds(3L))
       .get()
-      .getStatus() != ClusterHealthStatus.RED);
+      .getStatus() != ClusterHealthStatus.RED;
   }
 
   @Override