]> source.dussan.org Git - sonarqube.git/commitdiff
Fix quality issues
authorDuarte Meneses <duarte.meneses@sonarsource.com>
Mon, 23 Oct 2017 13:46:39 +0000 (15:46 +0200)
committerGrégoire Aubert <gregoire.aubert@sonarsource.com>
Mon, 23 Oct 2017 15:01:13 +0000 (08:01 -0700)
server/sonar-server/src/main/java/org/sonar/server/edition/StandaloneEditionManagementStateImpl.java
server/sonar-server/src/main/java/org/sonar/server/edition/ws/ClearErrorMessageAction.java
server/sonar-server/src/main/java/org/sonar/server/plugins/edition/EditionPluginDownloader.java

index 76d358c988d24840c535237bd29f8e37482bbd41..5435b7b307cddc8c4d4910f97e66733c173f2cff 100644 (file)
@@ -224,9 +224,11 @@ public class StandaloneEditionManagementStateImpl implements MutableEditionManag
 
   private State.Builder changeStatusToFrom(PendingStatus newStatus, PendingStatus... validPendingStatuses) {
     State currentState = this.state;
-    checkState(Arrays.stream(validPendingStatuses).anyMatch(s -> s == currentState.getPendingInstallationStatus()),
-      "Can't move to %s when status is %s (should be any of %s)",
-      newStatus, currentState.getPendingInstallationStatus(), Arrays.toString(validPendingStatuses));
+    if (Arrays.stream(validPendingStatuses).noneMatch(s -> s == currentState.getPendingInstallationStatus())) {
+      throw new IllegalStateException(String.format("Can't move to %s when status is %s (should be any of %s)",
+        newStatus, currentState.getPendingInstallationStatus(), Arrays.toString(validPendingStatuses)));
+    }
+
     return State.newBuilder(currentState, newStatus);
   }
 
index 7c9ecb43491ddc8f1857a8119ea8a65c180bbce3..86ee6bf85146a2f6bbdeda9cc6f9651c24115aed 100644 (file)
@@ -36,7 +36,7 @@ public class ClearErrorMessageAction implements EditionsWsAction {
 
   @Override
   public void define(WebService.NewController controller) {
-    WebService.NewAction action = controller.createAction("clear_error_message")
+    controller.createAction("clear_error_message")
       .setSince("6.7")
       .setPost(true)
       .setDescription("Clear error message of last install of an edition (if any). Require 'Administer System' permission.")
index 7801af2fb12f8174d78a9aec3c0121e996b66916..0da1f5d7cae0b65bf57ffb831ff0dd2616f1a709 100644 (file)
@@ -70,7 +70,7 @@ public class EditionPluginDownloader {
       FileUtils.deleteDirectory(downloadDir);
       Files.move(tmpDir, downloadDir);
     } catch (IOException e) {
-      throw new RuntimeException(e.getMessage(), e);
+      throw new IllegalStateException(e.getMessage(), e);
     } finally {
       FileUtils.deleteQuietly(tmpDir);
     }