diff options
4 files changed, 25 insertions, 29 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/step/QualityProfileEventsStep.java b/server/sonar-server/src/main/java/org/sonar/server/computation/step/QualityProfileEventsStep.java index 3a7c955b556..8c223e442ef 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/step/QualityProfileEventsStep.java +++ b/server/sonar-server/src/main/java/org/sonar/server/computation/step/QualityProfileEventsStep.java @@ -121,26 +121,26 @@ public class QualityProfileEventsStep implements ComputationStep { "key", profile.getQpKey(), "from", UtcDateUtils.formatDateTime(fixDate(from)), "to", UtcDateUtils.formatDateTime(fixDate(profile.getRulesUpdatedAt())))); - eventRepository.add(component, createQProfileEvent(component, profile, "Changes in %s", data)); + eventRepository.add(component, createQProfileEvent(profile, "Changes in %s", data)); } private void markAsRemoved(Component component, QualityProfile profile) { - eventRepository.add(component, createQProfileEvent(component, profile, "Stop using %s")); + eventRepository.add(component, createQProfileEvent(profile, "Stop using %s")); } private void markAsAdded(Component component, QualityProfile profile) { - eventRepository.add(component, createQProfileEvent(component, profile, "Use %s")); + eventRepository.add(component, createQProfileEvent(profile, "Use %s")); } - private Event createQProfileEvent(Component component, QualityProfile profile, String namePattern) { - return createQProfileEvent(component, profile, namePattern, null); + private Event createQProfileEvent(QualityProfile profile, String namePattern) { + return createQProfileEvent(profile, namePattern, null); } - private Event createQProfileEvent(Component component, QualityProfile profile, String namePattern, @Nullable String data) { - return Event.createProfile(String.format(namePattern, profileLabel(component, profile)), data, null); + private Event createQProfileEvent(QualityProfile profile, String namePattern, @Nullable String data) { + return Event.createProfile(String.format(namePattern, profileLabel(profile)), data, null); } - private String profileLabel(Component component, QualityProfile profile) { + private String profileLabel(QualityProfile profile) { Optional<Language> language = languageRepository.find(profile.getLanguageKey()); String languageName = language.isPresent() ? language.get().getName() : profile.getLanguageKey(); return String.format("'%s' (%s)", profile.getQpName(), languageName); @@ -149,7 +149,7 @@ public class QualityProfileEventsStep implements ComputationStep { /** * This hack must be done because date precision is millisecond in db/es and date format is select only */ - private Date fixDate(Date date) { + private static Date fixDate(Date date) { return DateUtils.addSeconds(date, 1); } diff --git a/server/sonar-server/src/main/java/org/sonar/server/platform/ws/MigrateDbSystemAction.java b/server/sonar-server/src/main/java/org/sonar/server/platform/ws/MigrateDbSystemAction.java index d2dddb36110..eb50027bea7 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/platform/ws/MigrateDbSystemAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/platform/ws/MigrateDbSystemAction.java @@ -55,9 +55,7 @@ public class MigrateDbSystemAction implements SystemWsAction { private final DatabaseMigration databaseMigration; private final Database database; - public MigrateDbSystemAction(DatabaseVersion databaseVersion, - Database database, - DatabaseMigration databaseMigration) { + public MigrateDbSystemAction(DatabaseVersion databaseVersion, Database database, DatabaseMigration databaseMigration) { this.databaseVersion = databaseVersion; this.database = database; this.databaseMigration = databaseMigration; @@ -114,7 +112,7 @@ public class MigrateDbSystemAction implements SystemWsAction { } } - private void writeNotSupportedResponse(Response response) { + private static void writeNotSupportedResponse(Response response) { JsonWriter jsonWriter = response.newJsonWriter(); jsonWriter.beginObject() .prop(PROPERTY_STATE, STATUS_NOT_SUPPORTED) @@ -126,10 +124,10 @@ public class MigrateDbSystemAction implements SystemWsAction { private void writeNoneResponse(Response response, DatabaseMigration databaseMigration) { JsonWriter jsonWriter = response.newJsonWriter(); jsonWriter.beginObject() - .prop(PROPERTY_STATE, statusToJson(RUNNING)) - .prop(PROPERTY_MESSAGE, MESSAGE_STATUS_RUNNING) - .propDateTime(PROPERTY_STARTED_AT, databaseMigration.startedAt()) - .endObject(); + .prop(PROPERTY_STATE, statusToJson(RUNNING)) + .prop(PROPERTY_MESSAGE, MESSAGE_STATUS_RUNNING) + .propDateTime(PROPERTY_STARTED_AT, databaseMigration.startedAt()) + .endObject(); jsonWriter.close(); } diff --git a/server/sonar-server/src/main/java/org/sonar/server/platform/ws/UpgradesAction.java b/server/sonar-server/src/main/java/org/sonar/server/platform/ws/UpgradesAction.java index 3b7c0a88426..8e2edabaa89 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/platform/ws/UpgradesAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/platform/ws/UpgradesAction.java @@ -20,6 +20,7 @@ package org.sonar.server.platform.ws; import com.google.common.io.Resources; +import java.util.List; import org.sonar.api.server.ws.Request; import org.sonar.api.server.ws.Response; import org.sonar.api.server.ws.WebService; @@ -31,8 +32,6 @@ import org.sonar.updatecenter.common.Release; import org.sonar.updatecenter.common.SonarUpdate; import org.sonar.updatecenter.common.UpdateCenter; -import java.util.List; - /** * Implementation of the {@code upgrades} action for the System WebService. */ @@ -110,7 +109,7 @@ public class UpgradesAction implements SystemWsAction { jsonWriter.endObject(); } - private void writeMetadata(JsonWriter jsonWriter, Release release) { + private static void writeMetadata(JsonWriter jsonWriter, Release release) { jsonWriter.prop(PROPERTY_VERSION, release.getVersion().getName()); jsonWriter.prop(PROPERTY_DESCRIPTION, release.getDescription()); jsonWriter.propDate(PROPERTY_RELEASE_DATE, release.getDate()); diff --git a/server/sonar-server/src/main/java/org/sonar/server/plugins/ws/AvailableAction.java b/server/sonar-server/src/main/java/org/sonar/server/plugins/ws/AvailableAction.java index 4bb68ba25d8..1b4df7beccd 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/plugins/ws/AvailableAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/plugins/ws/AvailableAction.java @@ -21,6 +21,7 @@ package org.sonar.server.plugins.ws; import com.google.common.collect.ImmutableSortedSet; import com.google.common.io.Resources; +import java.util.Collection; import org.sonar.api.server.ws.Request; import org.sonar.api.server.ws.Response; import org.sonar.api.server.ws.WebService; @@ -29,8 +30,6 @@ import org.sonar.server.plugins.UpdateCenterMatrixFactory; import org.sonar.updatecenter.common.PluginUpdate; import org.sonar.updatecenter.common.UpdateCenter; -import java.util.Collection; - import static org.sonar.server.plugins.ws.PluginWSCommons.NAME_KEY_PLUGIN_UPDATE_ORDERING; public class AvailableAction implements PluginsWsAction { @@ -54,12 +53,12 @@ public class AvailableAction implements PluginsWsAction { "Plugin information is retrieved from Update Center. Date and time at which Update Center was last refreshed is provided in the response." + "<br/>" + "Update status values are: " + - "<ul>" + - "<li>COMPATIBLE: plugin is compatible with current SonarQube instance.</li>" + - "<li>INCOMPATIBLE: plugin is not compatible with current SonarQube instance.</li>" + - "<li>REQUIRES_SYSTEM_UPGRADE: plugin requires SonarQube to be upgraded before being installed.</li>" + - "<li>DEPS_REQUIRE_SYSTEM_UPGRADE: at least one plugin on which the plugin is dependent requires SonarQube to be upgraded.</li>" + - "</ul>") + "<ul>" + + "<li>COMPATIBLE: plugin is compatible with current SonarQube instance.</li>" + + "<li>INCOMPATIBLE: plugin is not compatible with current SonarQube instance.</li>" + + "<li>REQUIRES_SYSTEM_UPGRADE: plugin requires SonarQube to be upgraded before being installed.</li>" + + "<li>DEPS_REQUIRE_SYSTEM_UPGRADE: at least one plugin on which the plugin is dependent requires SonarQube to be upgraded.</li>" + + "</ul>") .setSince("5.2") .setHandler(this) .setResponseExample(Resources.getResource(this.getClass(), "example-available_plugins.json")); @@ -88,7 +87,7 @@ public class AvailableAction implements PluginsWsAction { jsonWriter.endArray(); } - private Collection<PluginUpdate> retrieveAvailablePlugins(UpdateCenter updateCenter) { + private static Collection<PluginUpdate> retrieveAvailablePlugins(UpdateCenter updateCenter) { return ImmutableSortedSet.copyOf( NAME_KEY_PLUGIN_UPDATE_ORDERING, updateCenter.findAvailablePlugins() |