]> source.dussan.org Git - sonarqube.git/commitdiff
fix missing static keyword on some private methods
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Wed, 3 Jun 2015 13:12:05 +0000 (15:12 +0200)
committerSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Wed, 3 Jun 2015 13:27:19 +0000 (15:27 +0200)
server/sonar-server/src/main/java/org/sonar/server/computation/step/QualityProfileEventsStep.java
server/sonar-server/src/main/java/org/sonar/server/platform/ws/MigrateDbSystemAction.java
server/sonar-server/src/main/java/org/sonar/server/platform/ws/UpgradesAction.java
server/sonar-server/src/main/java/org/sonar/server/plugins/ws/AvailableAction.java

index 3a7c955b556c097cb711c8fd89f4414d3c58de31..8c223e442efb420faf65ba100588a0f9c36b8fc7 100644 (file)
@@ -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);
   }
 
index d2dddb36110b6e454df819d1fc2ffe318922d0ad..eb50027bea7a4a9de30a07a102c0bbd380e052b2 100644 (file)
@@ -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();
   }
 
index 3b7c0a8842668bd72a3ceb5e4a3b05e18a10393a..8e2edabaa89ecd7be1daf265aa6bae3abb767f25 100644 (file)
@@ -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());
index 4bb68ba25d8f1c17eb1e2d3ca1e494b0abfa3b57..1b4df7beccdcf018f5ef25bee8eeef1831de019a 100644 (file)
@@ -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()