aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeryk Bellahsene <teryk.bellahsene@sonarsource.com>2015-06-05 10:44:30 +0200
committerTeryk Bellahsene <teryk.bellahsene@sonarsource.com>2015-06-05 10:44:30 +0200
commit2029453c4933b478ff50d50d31e99d225a783ff6 (patch)
treeb0a2aa85a3e3aafd612138c3035a9de7d2af598e
parent58690404a2fcb8de9c0902bb1919dad2004b4da2 (diff)
downloadsonarqube-2029453c4933b478ff50d50d31e99d225a783ff6.tar.gz
sonarqube-2029453c4933b478ff50d50d31e99d225a783ff6.zip
fix bunch a 'Make 'XXX' a static method' issues
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/component/db/ComponentDao.java4
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/ReportQueue.java14
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/step/PersistMeasuresStep.java2
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/step/SwitchSnapshotStep.java4
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/ws/QueueAction.java2
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/custommeasure/persistence/package-info.java24
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/issue/notification/AbstractNewIssuesEmailTemplate.java17
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/issue/ws/ShowAction.java2
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/metric/ws/CreateAction.java11
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/metric/ws/DomainsAction.java2
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/metric/ws/SearchAction.java2
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/metric/ws/package-info.java24
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/platform/monitoring/SystemMonitor.java12
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/project/ws/GhostsAction.java6
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/project/ws/ProvisionedAction.java8
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/rule/ws/SearchAction.java2
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/test/index/TestIndexer.java12
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/test/ws/CoveredFilesAction.java2
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/test/ws/ListAction.java12
-rw-r--r--sonar-core/src/main/java/org/sonar/core/purge/PurgeDao.java13
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/database/model/Snapshot.java14
21 files changed, 115 insertions, 74 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/component/db/ComponentDao.java b/server/sonar-server/src/main/java/org/sonar/server/component/db/ComponentDao.java
index 52169547e35..1bcabb07020 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/component/db/ComponentDao.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/component/db/ComponentDao.java
@@ -195,13 +195,13 @@ public class ComponentDao implements DaoComponent {
return mapper(session).countGhostProjects(parameters);
}
- private void addPartialQueryParameterIfNotNull(Map<String, String> parameters, @Nullable String query) {
+ private static void addPartialQueryParameterIfNotNull(Map<String, String> parameters, @Nullable String query) {
if (query != null) {
parameters.put("query", "%" + query.toUpperCase() + "%");
}
}
- private void addProjectQualifier(Map<String, String> parameters) {
+ private static void addProjectQualifier(Map<String, String> parameters) {
parameters.put("qualifier", Qualifiers.PROJECT);
}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/ReportQueue.java b/server/sonar-server/src/main/java/org/sonar/server/computation/ReportQueue.java
index 9397abdf822..ceb6f615457 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/ReportQueue.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/ReportQueue.java
@@ -20,6 +20,11 @@
package org.sonar.server.computation;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.List;
+import javax.annotation.CheckForNull;
import org.apache.commons.io.FileUtils;
import org.sonar.api.config.Settings;
import org.sonar.api.server.ServerSide;
@@ -32,13 +37,6 @@ import org.sonar.process.ProcessProperties;
import org.sonar.server.computation.db.AnalysisReportDao;
import org.sonar.server.db.DbClient;
-import javax.annotation.CheckForNull;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.List;
-
import static org.sonar.core.computation.db.AnalysisReportDto.Status.PENDING;
@ServerSide
@@ -84,7 +82,7 @@ public class ReportQueue {
return dbClient.analysisReportDao();
}
- private void saveReportOnDisk(InputStream reportData, File file) throws IOException {
+ private static void saveReportOnDisk(InputStream reportData, File file) throws IOException {
FileUtils.copyInputStreamToFile(reportData, file);
}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/step/PersistMeasuresStep.java b/server/sonar-server/src/main/java/org/sonar/server/computation/step/PersistMeasuresStep.java
index f6f51d04271..44a20d7a9fe 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/step/PersistMeasuresStep.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/step/PersistMeasuresStep.java
@@ -138,7 +138,7 @@ public class PersistMeasuresStep implements ComputationStep {
return out;
}
- private MeasureDto setData(BatchReport.Measure in, MeasureDto out) {
+ private static MeasureDto setData(BatchReport.Measure in, MeasureDto out) {
if (in.hasStringValue()) {
out.setData(in.getStringValue());
}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/step/SwitchSnapshotStep.java b/server/sonar-server/src/main/java/org/sonar/server/computation/step/SwitchSnapshotStep.java
index d1bd3d2f85b..14060e9cd24 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/step/SwitchSnapshotStep.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/step/SwitchSnapshotStep.java
@@ -28,6 +28,8 @@ import org.sonar.server.component.db.SnapshotDao;
import org.sonar.server.computation.batch.BatchReportReader;
import org.sonar.server.db.DbClient;
+import static org.sonar.server.component.db.SnapshotDao.isLast;
+
public class SwitchSnapshotStep implements ComputationStep {
private final DbClient dbClient;
@@ -71,7 +73,7 @@ public class SwitchSnapshotStep implements ComputationStep {
SnapshotDto snapshot = dao.selectById(session, reportSnapshotId);
SnapshotDto previousLastSnapshot = dao.selectLastSnapshotByComponentId(session, snapshot.getComponentId());
- boolean isLast = dao.isLast(snapshot, previousLastSnapshot);
+ boolean isLast = isLast(snapshot, previousLastSnapshot);
dao.updateSnapshotAndChildrenLastFlagAndStatus(session, snapshot, isLast, SnapshotDto.STATUS_PROCESSED);
session.commit();
}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/ws/QueueAction.java b/server/sonar-server/src/main/java/org/sonar/server/computation/ws/QueueAction.java
index 0fe4c3d210c..caab5d33bc8 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/ws/QueueAction.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/ws/QueueAction.java
@@ -61,7 +61,7 @@ public class QueueAction implements ComputationWsAction {
json.close();
}
- private void writeReports(List<AnalysisReportDto> reports, JsonWriter json) {
+ private static void writeReports(List<AnalysisReportDto> reports, JsonWriter json) {
json.name("reports").beginArray();
for (AnalysisReportDto report : reports) {
json.beginObject();
diff --git a/server/sonar-server/src/main/java/org/sonar/server/custommeasure/persistence/package-info.java b/server/sonar-server/src/main/java/org/sonar/server/custommeasure/persistence/package-info.java
new file mode 100644
index 00000000000..c236052bdd4
--- /dev/null
+++ b/server/sonar-server/src/main/java/org/sonar/server/custommeasure/persistence/package-info.java
@@ -0,0 +1,24 @@
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+@ParametersAreNonnullByDefault
+package org.sonar.server.custommeasure.persistence;
+
+import javax.annotation.ParametersAreNonnullByDefault;
diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/notification/AbstractNewIssuesEmailTemplate.java b/server/sonar-server/src/main/java/org/sonar/server/issue/notification/AbstractNewIssuesEmailTemplate.java
index 044abf8543a..739cd130d91 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/issue/notification/AbstractNewIssuesEmailTemplate.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/issue/notification/AbstractNewIssuesEmailTemplate.java
@@ -21,6 +21,11 @@
package org.sonar.server.issue.notification;
import com.google.common.collect.Lists;
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.Locale;
import org.sonar.api.config.EmailSettings;
import org.sonar.api.i18n.I18n;
import org.sonar.api.notifications.Notification;
@@ -30,12 +35,6 @@ import org.sonar.plugins.emailnotifications.api.EmailMessage;
import org.sonar.plugins.emailnotifications.api.EmailTemplate;
import org.sonar.server.issue.notification.NewIssuesStatistics.Metric;
-import java.io.UnsupportedEncodingException;
-import java.net.URLEncoder;
-import java.util.Date;
-import java.util.Iterator;
-import java.util.Locale;
-
import static com.google.common.base.Preconditions.checkNotNull;
/**
@@ -102,7 +101,7 @@ public abstract class AbstractNewIssuesEmailTemplate extends EmailTemplate {
notification.getFieldValue(Metric.DEBT + COUNT));
}
- private boolean doNotHaveValue(Notification notification, Metric metric) {
+ private static boolean doNotHaveValue(Notification notification, Metric metric) {
return notification.getFieldValue(metric + DOT + "1" + LABEL) == null;
}
@@ -158,7 +157,7 @@ public abstract class AbstractNewIssuesEmailTemplate extends EmailTemplate {
.append(TAB)
.append(TAB);
- for (Iterator<String> severityIterator = Lists.reverse(Severity.ALL).iterator(); severityIterator.hasNext(); ) {
+ for (Iterator<String> severityIterator = Lists.reverse(Severity.ALL).iterator(); severityIterator.hasNext();) {
String severity = severityIterator.next();
String severityLabel = i18n.message(getLocale(), "severity." + severity, severity);
message.append(severityLabel).append(": ").append(notification.getFieldValue(Metric.SEVERITY + DOT + severity + COUNT));
@@ -186,7 +185,7 @@ public abstract class AbstractNewIssuesEmailTemplate extends EmailTemplate {
}
}
- private Locale getLocale() {
+ private static Locale getLocale() {
return Locale.ENGLISH;
}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/ws/ShowAction.java b/server/sonar-server/src/main/java/org/sonar/server/issue/ws/ShowAction.java
index c100572e6d1..7ab69a45769 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/issue/ws/ShowAction.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/issue/ws/ShowAction.java
@@ -191,7 +191,7 @@ public class ShowAction implements IssuesWsAction {
.prop("subProjectName", parentProjectName);
}
- private String projectName(ComponentDto project) {
+ private static String projectName(ComponentDto project) {
return project.longName() != null ? project.longName() : project.name();
}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/metric/ws/CreateAction.java b/server/sonar-server/src/main/java/org/sonar/server/metric/ws/CreateAction.java
index 75fbf567a5e..5760bc7bdd5 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/metric/ws/CreateAction.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/metric/ws/CreateAction.java
@@ -173,8 +173,7 @@ public class CreateAction implements MetricsWsAction {
if (areOneOfTheMandatoryArgumentsEmpty(template)) {
throw new IllegalArgumentException(String.format("The mandatory arguments '%s','%s' and '%s' must not be empty", PARAM_KEY, PARAM_NAME, PARAM_TYPE));
}
- if (
- metricIsNotInDb(metricInDb)) {
+ if (metricIsNotInDb(metricInDb)) {
return;
}
if (isMetricEnabled(metricInDb)) {
@@ -196,15 +195,15 @@ public class CreateAction implements MetricsWsAction {
return !customMeasures.isEmpty();
}
- private static boolean hasMetricTypeChanged(@Nullable MetricDto metricInDb, MetricDto template) {
+ private static boolean hasMetricTypeChanged(MetricDto metricInDb, MetricDto template) {
return !metricInDb.getValueType().equals(template.getValueType());
}
- private static boolean isMetricNonCustom(@Nullable MetricDto metricInDb) {
+ private static boolean isMetricNonCustom(MetricDto metricInDb) {
return !metricInDb.isUserManaged();
}
- private static boolean isMetricEnabled(@Nullable MetricDto metricInDb) {
+ private static boolean isMetricEnabled(MetricDto metricInDb) {
return metricInDb.isEnabled();
}
@@ -216,7 +215,7 @@ public class CreateAction implements MetricsWsAction {
return template.getValueType().isEmpty() || template.getShortName().isEmpty() || template.getKey().isEmpty();
}
- private void writeMetric(JsonWriter json, MetricDto metric) {
+ private static void writeMetric(JsonWriter json, MetricDto metric) {
json.beginObject();
json.prop(FIELD_ID, metric.getId());
json.prop(FIELD_KEY, metric.getKey());
diff --git a/server/sonar-server/src/main/java/org/sonar/server/metric/ws/DomainsAction.java b/server/sonar-server/src/main/java/org/sonar/server/metric/ws/DomainsAction.java
index 25cfb3befda..5b732da8ded 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/metric/ws/DomainsAction.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/metric/ws/DomainsAction.java
@@ -62,7 +62,7 @@ public class DomainsAction implements MetricsWsAction {
}
}
- private void writeDomains(JsonWriter json, List<String> domains) {
+ private static void writeDomains(JsonWriter json, List<String> domains) {
json.name("domains");
json.beginArray();
json.values(domains);
diff --git a/server/sonar-server/src/main/java/org/sonar/server/metric/ws/SearchAction.java b/server/sonar-server/src/main/java/org/sonar/server/metric/ws/SearchAction.java
index 57f577cfb4d..d5301ac7422 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/metric/ws/SearchAction.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/metric/ws/SearchAction.java
@@ -126,7 +126,7 @@ public class SearchAction implements MetricsWsAction {
json.endArray();
}
- private void writeIfDesired(JsonWriter json, String field, String value, Set<String> desiredFields) {
+ private static void writeIfDesired(JsonWriter json, String field, String value, Set<String> desiredFields) {
if (desiredFields.contains(field)) {
json.prop(field, value);
}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/metric/ws/package-info.java b/server/sonar-server/src/main/java/org/sonar/server/metric/ws/package-info.java
new file mode 100644
index 00000000000..4af4a956c67
--- /dev/null
+++ b/server/sonar-server/src/main/java/org/sonar/server/metric/ws/package-info.java
@@ -0,0 +1,24 @@
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+@ParametersAreNonnullByDefault
+package org.sonar.server.metric.ws;
+
+import javax.annotation.ParametersAreNonnullByDefault;
diff --git a/server/sonar-server/src/main/java/org/sonar/server/platform/monitoring/SystemMonitor.java b/server/sonar-server/src/main/java/org/sonar/server/platform/monitoring/SystemMonitor.java
index e40f13fc542..c7328ad2aa1 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/platform/monitoring/SystemMonitor.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/platform/monitoring/SystemMonitor.java
@@ -79,27 +79,27 @@ public class SystemMonitor implements Monitor {
return attributes;
}
- private RuntimeMXBean runtimeMXBean() {
+ private static RuntimeMXBean runtimeMXBean() {
return ManagementFactory.getRuntimeMXBean();
}
- private Runtime runtime() {
+ private static Runtime runtime() {
return Runtime.getRuntime();
}
- private MemoryMXBean memoryMXBean() {
+ private static MemoryMXBean memoryMXBean() {
return ManagementFactory.getMemoryMXBean();
}
- private ClassLoadingMXBean classLoadingMXBean() {
+ private static ClassLoadingMXBean classLoadingMXBean() {
return ManagementFactory.getClassLoadingMXBean();
}
- private ThreadMXBean threadMXBean() {
+ private static ThreadMXBean threadMXBean() {
return ManagementFactory.getThreadMXBean();
}
- private String formatMemory(long memoryInBytes) {
+ private static String formatMemory(long memoryInBytes) {
return String.format("%d MB", memoryInBytes / 1_000_000);
}
}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/project/ws/GhostsAction.java b/server/sonar-server/src/main/java/org/sonar/server/project/ws/GhostsAction.java
index b80814de3d4..d5b645a19f8 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/project/ws/GhostsAction.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/project/ws/GhostsAction.java
@@ -103,19 +103,19 @@ public class GhostsAction implements ProjectsWsAction {
json.endArray();
}
- private void writeIfWished(JsonWriter json, String key, String value, Set<String> fieldsToReturn) {
+ private static void writeIfWished(JsonWriter json, String key, String value, Set<String> fieldsToReturn) {
if (fieldsToReturn.contains(key)) {
json.prop(key, value);
}
}
- private void writeIfWished(JsonWriter json, String key, Date value, Set<String> desiredFields) {
+ private static void writeIfWished(JsonWriter json, String key, Date value, Set<String> desiredFields) {
if (desiredFields.contains(key)) {
json.propDateTime(key, value);
}
}
- private Set<String> fieldsToReturn(@Nullable List<String> desiredFieldsFromRequest) {
+ private static Set<String> fieldsToReturn(@Nullable List<String> desiredFieldsFromRequest) {
if (desiredFieldsFromRequest == null) {
return POSSIBLE_FIELDS;
}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/project/ws/ProvisionedAction.java b/server/sonar-server/src/main/java/org/sonar/server/project/ws/ProvisionedAction.java
index 8825707c1fc..3cff3218994 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/project/ws/ProvisionedAction.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/project/ws/ProvisionedAction.java
@@ -89,7 +89,7 @@ public class ProvisionedAction implements ProjectsWsAction {
}
}
- private void writeProjects(List<ComponentDto> projects, JsonWriter json, Set<String> desiredFields) {
+ private static void writeProjects(List<ComponentDto> projects, JsonWriter json, Set<String> desiredFields) {
json.name("projects");
json.beginArray();
for (ComponentDto project : projects) {
@@ -103,19 +103,19 @@ public class ProvisionedAction implements ProjectsWsAction {
json.endArray();
}
- private void writeIfNeeded(JsonWriter json, String fieldName, String value, Set<String> desiredFields) {
+ private static void writeIfNeeded(JsonWriter json, String fieldName, String value, Set<String> desiredFields) {
if (desiredFields.contains(fieldName)) {
json.prop(fieldName, value);
}
}
- private void writeIfNeeded(JsonWriter json, String fieldName, Date date, Set<String> desiredFields) {
+ private static void writeIfNeeded(JsonWriter json, String fieldName, Date date, Set<String> desiredFields) {
if (desiredFields.contains(fieldName)) {
json.propDateTime(fieldName, date);
}
}
- private Set<String> desiredFields(Request request) {
+ private static Set<String> desiredFields(Request request) {
List<String> desiredFields = request.paramAsStrings(Param.FIELDS);
if (desiredFields == null) {
return POSSIBLE_FIELDS;
diff --git a/server/sonar-server/src/main/java/org/sonar/server/rule/ws/SearchAction.java b/server/sonar-server/src/main/java/org/sonar/server/rule/ws/SearchAction.java
index 88b5c42d8d0..1f1b62e3d34 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/rule/ws/SearchAction.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/rule/ws/SearchAction.java
@@ -424,7 +424,7 @@ public class SearchAction implements RulesWsAction {
}
}
- private void addZeroFacetsForSelectedItems(Request request, String facetName, Set<String> itemsFromFacets, JsonWriter json) {
+ private static void addZeroFacetsForSelectedItems(Request request, String facetName, Set<String> itemsFromFacets, JsonWriter json) {
List<String> requestParams = request.paramAsStrings(facetName);
if (requestParams != null) {
for (String param : requestParams) {
diff --git a/server/sonar-server/src/main/java/org/sonar/server/test/index/TestIndexer.java b/server/sonar-server/src/main/java/org/sonar/server/test/index/TestIndexer.java
index b508d8e87c7..676d31b35f9 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/test/index/TestIndexer.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/test/index/TestIndexer.java
@@ -61,6 +61,11 @@ public class TestIndexer extends BaseIndexer {
});
}
+ public long index(Iterator<FileSourcesUpdaterHelper.Row> dbRows) {
+ BulkIndexer bulk = new BulkIndexer(esClient, INDEX);
+ return doIndex(bulk, dbRows);
+ }
+
@Override
protected long doIndex(long lastUpdatedAt) {
return doIndex(lastUpdatedAt, null);
@@ -83,12 +88,7 @@ public class TestIndexer extends BaseIndexer {
}
}
- public long index(Iterator<FileSourcesUpdaterHelper.Row> dbRows) {
- BulkIndexer bulk = new BulkIndexer(esClient, INDEX);
- return doIndex(bulk, dbRows);
- }
-
- private long doIndex(BulkIndexer bulk, Iterator<FileSourcesUpdaterHelper.Row> dbRows) {
+ private static long doIndex(BulkIndexer bulk, Iterator<FileSourcesUpdaterHelper.Row> dbRows) {
long maxUpdatedAt = 0L;
bulk.start();
while (dbRows.hasNext()) {
diff --git a/server/sonar-server/src/main/java/org/sonar/server/test/ws/CoveredFilesAction.java b/server/sonar-server/src/main/java/org/sonar/server/test/ws/CoveredFilesAction.java
index e09b0c34a1b..eaca60d69f3 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/test/ws/CoveredFilesAction.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/test/ws/CoveredFilesAction.java
@@ -84,7 +84,7 @@ public class CoveredFilesAction implements TestsWsAction {
json.endObject().close();
}
- private void writeTests(List<CoveredFileDoc> coveredFiles, Map<String, ComponentDto> componentsByUuid, JsonWriter json) {
+ private static void writeTests(List<CoveredFileDoc> coveredFiles, Map<String, ComponentDto> componentsByUuid, JsonWriter json) {
json.name("files").beginArray();
for (CoveredFileDoc coveredFile : coveredFiles) {
json.beginObject();
diff --git a/server/sonar-server/src/main/java/org/sonar/server/test/ws/ListAction.java b/server/sonar-server/src/main/java/org/sonar/server/test/ws/ListAction.java
index d757bc46c25..95953cf3db3 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/test/ws/ListAction.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/test/ws/ListAction.java
@@ -23,6 +23,9 @@ package org.sonar.server.test.ws;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.io.Resources;
+import java.util.List;
+import java.util.Map;
+import javax.annotation.Nullable;
import org.sonar.api.server.ws.Request;
import org.sonar.api.server.ws.Response;
import org.sonar.api.server.ws.WebService;
@@ -40,11 +43,6 @@ import org.sonar.server.test.index.TestDoc;
import org.sonar.server.test.index.TestIndex;
import org.sonar.server.user.UserSession;
-import javax.annotation.Nullable;
-
-import java.util.List;
-import java.util.Map;
-
public class ListAction implements TestsWsAction {
public static final String TEST_UUID = "testUuid";
public static final String TEST_FILE_UUID = "testFileUuid";
@@ -116,7 +114,7 @@ public class ListAction implements TestsWsAction {
SearchOptions searchOptions = new SearchOptions().setPage(
request.mandatoryParamAsInt(WebService.Param.PAGE),
request.mandatoryParamAsInt(WebService.Param.PAGE_SIZE)
- );
+ );
DbSession dbSession = dbClient.openSession(false);
SearchResult<TestDoc> tests;
@@ -154,7 +152,7 @@ public class ListAction implements TestsWsAction {
json.endArray();
}
- private long coveredLines(List<CoveredFileDoc> coveredFiles) {
+ private static long coveredLines(List<CoveredFileDoc> coveredFiles) {
long numberOfLinesCovered = 0L;
for (CoveredFileDoc coveredFile : coveredFiles) {
numberOfLinesCovered += coveredFile.coveredLines().size();
diff --git a/sonar-core/src/main/java/org/sonar/core/purge/PurgeDao.java b/sonar-core/src/main/java/org/sonar/core/purge/PurgeDao.java
index e35163b64d8..6675a98f10e 100644
--- a/sonar-core/src/main/java/org/sonar/core/purge/PurgeDao.java
+++ b/sonar-core/src/main/java/org/sonar/core/purge/PurgeDao.java
@@ -20,6 +20,11 @@
package org.sonar.core.purge;
import com.google.common.collect.Lists;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
import org.apache.commons.lang.ArrayUtils;
import org.apache.ibatis.session.ResultContext;
import org.apache.ibatis.session.ResultHandler;
@@ -33,12 +38,6 @@ import org.sonar.core.persistence.MyBatis;
import org.sonar.core.resource.ResourceDao;
import org.sonar.core.resource.ResourceDto;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Date;
-import java.util.List;
-
import static org.sonar.api.utils.DateUtils.dateToLong;
/**
@@ -187,7 +186,7 @@ public class PurgeDao implements DaoComponent {
return this;
}
- private void deleteFileSources(String rootUuid, PurgeCommands commands) {
+ private static void deleteFileSources(String rootUuid, PurgeCommands commands) {
commands.deleteFileSources(rootUuid);
}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/database/model/Snapshot.java b/sonar-plugin-api/src/main/java/org/sonar/api/database/model/Snapshot.java
index cd22585f357..063e927ecc2 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/database/model/Snapshot.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/database/model/Snapshot.java
@@ -19,6 +19,11 @@
*/
package org.sonar.api.database.model;
+import java.io.Serializable;
+import java.util.Date;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Table;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ReflectionToStringBuilder;
@@ -26,13 +31,6 @@ import org.apache.commons.lang.builder.ToStringStyle;
import org.sonar.api.database.BaseIdentifiable;
import org.sonar.api.database.DatabaseSession;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Table;
-
-import java.io.Serializable;
-import java.util.Date;
-
import static org.sonar.api.utils.DateUtils.dateToLong;
import static org.sonar.api.utils.DateUtils.longToDate;
@@ -795,7 +793,7 @@ public class Snapshot extends BaseIdentifiable<Snapshot> implements Serializable
}
}
- private IndexOutOfBoundsException newPeriodIndexOutOfBoundsException(String field) {
+ private static IndexOutOfBoundsException newPeriodIndexOutOfBoundsException(String field) {
return new IndexOutOfBoundsException(String.format("Index of Snapshot.%s is between 1 and 5", field));
}