aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-server
diff options
context:
space:
mode:
authorDuarte Meneses <duarte.meneses@sonarsource.com>2017-10-23 15:46:39 +0200
committerGrégoire Aubert <gregoire.aubert@sonarsource.com>2017-10-23 08:01:13 -0700
commitaf7359271037ddcf327e0d9f76b0f6171a8e5840 (patch)
treeeb0636eedbbbb62f57e052c4a3b4438fbec7a5dd /server/sonar-server
parent8260558f49f1ea651f69206a943ac1e3eaa814b1 (diff)
downloadsonarqube-af7359271037ddcf327e0d9f76b0f6171a8e5840.tar.gz
sonarqube-af7359271037ddcf327e0d9f76b0f6171a8e5840.zip
Fix quality issues
Diffstat (limited to 'server/sonar-server')
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/edition/StandaloneEditionManagementStateImpl.java8
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/edition/ws/ClearErrorMessageAction.java2
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/plugins/edition/EditionPluginDownloader.java2
3 files changed, 7 insertions, 5 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/edition/StandaloneEditionManagementStateImpl.java b/server/sonar-server/src/main/java/org/sonar/server/edition/StandaloneEditionManagementStateImpl.java
index 76d358c988d..5435b7b307c 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/edition/StandaloneEditionManagementStateImpl.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/edition/StandaloneEditionManagementStateImpl.java
@@ -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);
}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/edition/ws/ClearErrorMessageAction.java b/server/sonar-server/src/main/java/org/sonar/server/edition/ws/ClearErrorMessageAction.java
index 7c9ecb43491..86ee6bf8514 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/edition/ws/ClearErrorMessageAction.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/edition/ws/ClearErrorMessageAction.java
@@ -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.")
diff --git a/server/sonar-server/src/main/java/org/sonar/server/plugins/edition/EditionPluginDownloader.java b/server/sonar-server/src/main/java/org/sonar/server/plugins/edition/EditionPluginDownloader.java
index 7801af2fb12..0da1f5d7cae 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/plugins/edition/EditionPluginDownloader.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/plugins/edition/EditionPluginDownloader.java
@@ -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);
}