diff options
Diffstat (limited to 'server/sonar-server')
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); } |