From: Sébastien Lesaint Date: Tue, 22 Mar 2016 11:34:35 +0000 (+0100) Subject: fix quality flaws X-Git-Tag: 5.5-M11~48 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=eec3233505be2d6d9cc95c9bfc8359b91572ac51;p=sonarqube.git fix quality flaws --- diff --git a/server/sonar-ce/src/main/java/org/sonar/ce/app/CeServer.java b/server/sonar-ce/src/main/java/org/sonar/ce/app/CeServer.java index 986f957bab7..3ea020171f0 100644 --- a/server/sonar-ce/src/main/java/org/sonar/ce/app/CeServer.java +++ b/server/sonar-ce/src/main/java/org/sonar/ce/app/CeServer.java @@ -129,19 +129,6 @@ public class CeServer implements Monitored { } } - private void stopAwait() { - stopAwait = true; - Thread t = awaitThread.get(); - if (t != null) { - t.interrupt(); - try { - t.join(1000); - } catch (InterruptedException e) { - // Ignored - } - } - } - private class CeMainThread extends Thread { private static final int CHECK_FOR_STOP_DELAY = 50; private volatile boolean stop = false; @@ -227,6 +214,19 @@ public class CeServer implements Monitored { // interrupt current thread in case its waiting for WebServer interrupt(); } + + private void stopAwait() { + stopAwait = true; + Thread t = awaitThread.get(); + if (t != null) { + t.interrupt(); + try { + t.join(1000); + } catch (InterruptedException e) { + // Ignored + } + } + } } } diff --git a/server/sonar-ce/src/test/java/org/sonar/ce/app/CeServerTest.java b/server/sonar-ce/src/test/java/org/sonar/ce/app/CeServerTest.java index 62e5382cfb1..c863a9a8da3 100644 --- a/server/sonar-ce/src/test/java/org/sonar/ce/app/CeServerTest.java +++ b/server/sonar-ce/src/test/java/org/sonar/ce/app/CeServerTest.java @@ -28,7 +28,6 @@ import org.junit.After; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; -import org.junit.rules.TemporaryFolder; import org.junit.rules.Timeout; import org.mockito.Mockito; import org.sonar.ce.ComputeEngine; @@ -44,8 +43,6 @@ public class CeServerTest { public Timeout timeout = Timeout.seconds(50); @Rule public ExpectedException expectedException = ExpectedException.none(); - @Rule - public TemporaryFolder temp = new TemporaryFolder(); private CeServer underTest = null; private Thread waitingThread = null; diff --git a/server/sonar-process/src/main/java/org/sonar/process/AllProcessesCommands.java b/server/sonar-process/src/main/java/org/sonar/process/AllProcessesCommands.java index d22a6ba1050..a3b0b8364c9 100644 --- a/server/sonar-process/src/main/java/org/sonar/process/AllProcessesCommands.java +++ b/server/sonar-process/src/main/java/org/sonar/process/AllProcessesCommands.java @@ -52,8 +52,10 @@ import static org.sonar.process.ProcessCommands.MAX_PROCESSES; * *

@@ -76,7 +78,7 @@ public class AllProcessesCommands { private static final byte UP = (byte) 0x01; private static final byte EMPTY = (byte) 0x00; - //VisibleForTesting + // VisibleForTesting final MappedByteBuffer mappedByteBuffer; private final RandomAccessFile sharedMemory; diff --git a/server/sonar-server/src/main/java/org/sonar/ce/taskprocessor/ReportTaskProcessorDeclaration.java b/server/sonar-server/src/main/java/org/sonar/ce/taskprocessor/ReportTaskProcessorDeclaration.java index af2f851fa17..0ac461f6521 100644 --- a/server/sonar-server/src/main/java/org/sonar/ce/taskprocessor/ReportTaskProcessorDeclaration.java +++ b/server/sonar-server/src/main/java/org/sonar/ce/taskprocessor/ReportTaskProcessorDeclaration.java @@ -39,6 +39,6 @@ public class ReportTaskProcessorDeclaration implements CeTaskProcessor { @Override public CeTaskResult process(CeTask task) { - throw new UnsupportedOperationException("process must not be called in WebServer"); + throw new UnsupportedOperationException("process must not be called in WebServer"); } } diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/qualitygate/EvaluationResultTextConverterImpl.java b/server/sonar-server/src/main/java/org/sonar/server/computation/qualitygate/EvaluationResultTextConverterImpl.java index 8909c1e5f30..b7fc99d1ce2 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/qualitygate/EvaluationResultTextConverterImpl.java +++ b/server/sonar-server/src/main/java/org/sonar/server/computation/qualitygate/EvaluationResultTextConverterImpl.java @@ -75,7 +75,7 @@ public final class EvaluationResultTextConverterImpl implements EvaluationResult stringBuilder.append(metric); if (alertPeriod != null && !condition.getMetric().getKey().startsWith(VARIATION_METRIC_PREFIX)) { - String variation = i18n.message(Locale.ENGLISH, VARIATION, VARIATION).toLowerCase(); + String variation = i18n.message(Locale.ENGLISH, VARIATION, VARIATION).toLowerCase(Locale.ENGLISH); stringBuilder.append(" ").append(variation); } diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/taskprocessor/CeWorkerCallableImpl.java b/server/sonar-server/src/main/java/org/sonar/server/computation/taskprocessor/CeWorkerCallableImpl.java index b0c0e599b88..11c84800166 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/taskprocessor/CeWorkerCallableImpl.java +++ b/server/sonar-server/src/main/java/org/sonar/server/computation/taskprocessor/CeWorkerCallableImpl.java @@ -22,13 +22,12 @@ package org.sonar.server.computation.taskprocessor; import com.google.common.base.Optional; import org.sonar.api.utils.log.Logger; import org.sonar.api.utils.log.Loggers; -import org.sonar.ce.taskprocessor.CeTaskProcessor; -import org.sonar.core.util.logs.Profiler; -import org.sonar.db.ce.CeActivityDto; import org.sonar.ce.log.CeLogging; -import org.sonar.ce.queue.CeQueue; import org.sonar.ce.queue.CeTask; import org.sonar.ce.queue.CeTaskResult; +import org.sonar.ce.taskprocessor.CeTaskProcessor; +import org.sonar.core.util.logs.Profiler; +import org.sonar.db.ce.CeActivityDto; import org.sonar.server.computation.queue.InternalCeQueue; import static java.lang.String.format; diff --git a/server/sonar-server/src/test/java/org/sonar/server/platform/ws/RestartActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/platform/ws/RestartActionTest.java index 082da463f46..8d08facfdf5 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/platform/ws/RestartActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/platform/ws/RestartActionTest.java @@ -22,7 +22,6 @@ package org.sonar.server.platform.ws; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; -import org.junit.rules.TemporaryFolder; import org.sonar.api.config.Settings; import org.sonar.api.utils.log.LogTester; import org.sonar.api.utils.log.LoggerLevel; @@ -44,8 +43,6 @@ public class RestartActionTest { @Rule public ExpectedException expectedException = ExpectedException.none(); @Rule - public TemporaryFolder temp = new TemporaryFolder(); - @Rule public LogTester logTester = new LogTester(); private Settings settings = new Settings();