summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/period/DefaultPeriodCleaner.java2
-rw-r--r--plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/period/DeleteAllFilter.java6
-rw-r--r--plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/period/Filter.java6
-rw-r--r--plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/period/Filters.java14
-rw-r--r--plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/period/KeepOneFilter.java6
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/scan/AnalyzerContextAdaptor.java6
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/profiles/RulesProfile.java1
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/profiles/XMLProfileParser.java2
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/server/ws/RequestTest.java2
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/server/ws/internal/SimpleGetRequestTest.java37
-rw-r--r--sonar-server/src/main/java/org/sonar/server/charts/deprecated/CustomBarChart.java2
-rw-r--r--sonar-server/src/main/java/org/sonar/server/db/migrations/v44/ChangeLogMigration.java8
-rw-r--r--sonar-server/src/main/java/org/sonar/server/duplication/ws/DuplicationsParser.java2
-rw-r--r--sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/RuleActivationActions.java2
-rw-r--r--sonar-server/src/main/java/org/sonar/server/rule/index/RuleDoc.java11
-rw-r--r--sonar-server/src/main/java/org/sonar/server/rule/index/RuleIndex.java24
-rw-r--r--sonar-server/src/main/java/org/sonar/server/search/IndexSynchronizer.java2
-rw-r--r--sonar-server/src/main/java/org/sonar/server/startup/RegisterNewMeasureFilters.java6
18 files changed, 89 insertions, 50 deletions
diff --git a/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/period/DefaultPeriodCleaner.java b/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/period/DefaultPeriodCleaner.java
index 9d5993cfac1..ade98c3dbaf 100644
--- a/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/period/DefaultPeriodCleaner.java
+++ b/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/period/DefaultPeriodCleaner.java
@@ -48,7 +48,7 @@ public class DefaultPeriodCleaner implements TaskExtension {
}
public void clean(long projectId) {
- doClean(projectId, new Filters(settings).getFilters());
+ doClean(projectId, new Filters(settings).all());
}
@VisibleForTesting
diff --git a/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/period/DeleteAllFilter.java b/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/period/DeleteAllFilter.java
index 5a1bcbd381f..18a795e1ee7 100644
--- a/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/period/DeleteAllFilter.java
+++ b/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/period/DeleteAllFilter.java
@@ -27,7 +27,7 @@ import org.sonar.core.purge.PurgeableSnapshotDto;
import java.util.Date;
import java.util.List;
-class DeleteAllFilter extends Filter {
+class DeleteAllFilter implements Filter {
private final Date before;
public DeleteAllFilter(Date before) {
@@ -35,7 +35,7 @@ class DeleteAllFilter extends Filter {
}
@Override
- List<PurgeableSnapshotDto> filter(List<PurgeableSnapshotDto> history) {
+ public List<PurgeableSnapshotDto> filter(List<PurgeableSnapshotDto> history) {
List<PurgeableSnapshotDto> result = Lists.newArrayList();
for (PurgeableSnapshotDto snapshot : history) {
if (snapshot.getDate().before(before)) {
@@ -46,7 +46,7 @@ class DeleteAllFilter extends Filter {
}
@Override
- void log() {
+ public void log() {
LoggerFactory.getLogger(getClass()).info("-> Delete data prior to: " + DateUtils.formatDate(before));
}
}
diff --git a/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/period/Filter.java b/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/period/Filter.java
index 7bc0b6d6290..4d4419be8c4 100644
--- a/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/period/Filter.java
+++ b/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/period/Filter.java
@@ -23,8 +23,8 @@ import org.sonar.core.purge.PurgeableSnapshotDto;
import java.util.List;
-abstract class Filter {
- abstract List<PurgeableSnapshotDto> filter(List<PurgeableSnapshotDto> snapshots);
+interface Filter {
+ List<PurgeableSnapshotDto> filter(List<PurgeableSnapshotDto> snapshots);
- abstract void log();
+ void log();
}
diff --git a/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/period/Filters.java b/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/period/Filters.java
index 62f7680cc65..c291cd8fec4 100644
--- a/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/period/Filters.java
+++ b/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/period/Filters.java
@@ -29,7 +29,7 @@ import java.util.Date;
import java.util.List;
class Filters {
- private final List<Filter> filters = Lists.newArrayList();
+ private final List<Filter> all = Lists.newArrayList();
Filters(Settings settings) {
Date dateToStartKeepingOneSnapshotByDay = getDateFromHours(settings, DbCleanerConstants.HOURS_BEFORE_KEEPING_ONLY_ONE_SNAPSHOT_BY_DAY);
@@ -37,14 +37,14 @@ class Filters {
Date dateToStartKeepingOneSnapshotByMonth = getDateFromWeeks(settings, DbCleanerConstants.WEEKS_BEFORE_KEEPING_ONLY_ONE_SNAPSHOT_BY_MONTH);
Date dateToStartDeletingAllSnapshots = getDateFromWeeks(settings, DbCleanerConstants.WEEKS_BEFORE_DELETING_ALL_SNAPSHOTS);
- filters.add(new KeepOneFilter(dateToStartKeepingOneSnapshotByWeek, dateToStartKeepingOneSnapshotByDay, Calendar.DAY_OF_YEAR, "day"));
- filters.add(new KeepOneFilter(dateToStartKeepingOneSnapshotByMonth, dateToStartKeepingOneSnapshotByWeek, Calendar.WEEK_OF_YEAR, "week"));
- filters.add(new KeepOneFilter(dateToStartDeletingAllSnapshots, dateToStartKeepingOneSnapshotByMonth, Calendar.MONTH, "month"));
- filters.add(new DeleteAllFilter(dateToStartDeletingAllSnapshots));
+ all.add(new KeepOneFilter(dateToStartKeepingOneSnapshotByWeek, dateToStartKeepingOneSnapshotByDay, Calendar.DAY_OF_YEAR, "day"));
+ all.add(new KeepOneFilter(dateToStartKeepingOneSnapshotByMonth, dateToStartKeepingOneSnapshotByWeek, Calendar.WEEK_OF_YEAR, "week"));
+ all.add(new KeepOneFilter(dateToStartDeletingAllSnapshots, dateToStartKeepingOneSnapshotByMonth, Calendar.MONTH, "month"));
+ all.add(new DeleteAllFilter(dateToStartDeletingAllSnapshots));
}
- List<Filter> getFilters() {
- return filters;
+ List<Filter> all() {
+ return all;
}
static Date getDateFromWeeks(Settings settings, String propertyKey) {
diff --git a/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/period/KeepOneFilter.java b/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/period/KeepOneFilter.java
index 45ad24cf5ff..81249fdd929 100644
--- a/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/period/KeepOneFilter.java
+++ b/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/period/KeepOneFilter.java
@@ -28,7 +28,7 @@ import org.sonar.core.purge.PurgeableSnapshotDto;
import java.util.Date;
import java.util.List;
-class KeepOneFilter extends Filter {
+class KeepOneFilter implements Filter {
private final Date start;
private final Date end;
@@ -43,7 +43,7 @@ class KeepOneFilter extends Filter {
}
@Override
- List<PurgeableSnapshotDto> filter(List<PurgeableSnapshotDto> history) {
+ public List<PurgeableSnapshotDto> filter(List<PurgeableSnapshotDto> history) {
List<Interval> intervals = Interval.group(history, start, end, dateField);
List<PurgeableSnapshotDto> result = Lists.newArrayList();
for (Interval interval : intervals) {
@@ -54,7 +54,7 @@ class KeepOneFilter extends Filter {
}
@Override
- void log() {
+ public void log() {
LoggerFactory.getLogger(getClass()).info("-> Keep one snapshot per " + label + " between " + DateUtils.formatDate(start) + " and " + DateUtils.formatDate(end));
}
diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan/AnalyzerContextAdaptor.java b/sonar-batch/src/main/java/org/sonar/batch/scan/AnalyzerContextAdaptor.java
index e1bf875059f..d92769f308c 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/scan/AnalyzerContextAdaptor.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/scan/AnalyzerContextAdaptor.java
@@ -171,13 +171,13 @@ public class AnalyzerContextAdaptor implements AnalyzerContext {
measureToSave.setData(((String) measure.value()));
break;
case WORK_DUR:
- measureToSave.setValue(Double.valueOf(((Long) measure.value())));
+ measureToSave.setValue(Double.valueOf((Long) measure.value()));
break;
default:
if (m.isNumericType()) {
- measureToSave.setValue(((Double) measure.value()));
+ measureToSave.setValue((Double) measure.value());
} else if (m.isDataType()) {
- measureToSave.setData(((String) measure.value()));
+ measureToSave.setData((String) measure.value());
} else {
throw new UnsupportedOperationException("Unsupported type :" + m.getType());
}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/profiles/RulesProfile.java b/sonar-plugin-api/src/main/java/org/sonar/api/profiles/RulesProfile.java
index 1847682f736..c3813ba404e 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/profiles/RulesProfile.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/profiles/RulesProfile.java
@@ -135,6 +135,7 @@ public class RulesProfile implements Cloneable {
/**
* @deprecated profile versioning is dropped in 4.4. Always returns -1.
*/
+ @CheckForNull
@Deprecated
public Boolean getUsed() {
return null;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/profiles/XMLProfileParser.java b/sonar-plugin-api/src/main/java/org/sonar/api/profiles/XMLProfileParser.java
index 5ce3cb8a945..8519072307c 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/profiles/XMLProfileParser.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/profiles/XMLProfileParser.java
@@ -40,8 +40,6 @@ import java.util.HashMap;
import java.util.Map;
/**
- * TODO should be an interface
- *
* @since 2.3
*/
public class XMLProfileParser implements ServerComponent {
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/server/ws/RequestTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/server/ws/RequestTest.java
index 58994058c11..407a4f8f0ff 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/server/ws/RequestTest.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/server/ws/RequestTest.java
@@ -162,6 +162,8 @@ public class RequestTest {
@Test
public void param_as_long() throws Exception {
assertThat(request.setParam("a_number", "123").paramAsLong("a_number")).isEqualTo(123L);
+ assertThat(request.setParam("a_number", "123").paramAsLong("a_number", 42L)).isEqualTo(123L);
+ assertThat(request.setParam("a_number", null).paramAsLong("a_number", 42L)).isEqualTo(123L);
}
@Test
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/server/ws/internal/SimpleGetRequestTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/server/ws/internal/SimpleGetRequestTest.java
new file mode 100644
index 00000000000..26be2948d03
--- /dev/null
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/server/ws/internal/SimpleGetRequestTest.java
@@ -0,0 +1,37 @@
+/*
+ * 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.
+ */
+package org.sonar.api.server.ws.internal;
+
+import org.junit.Test;
+
+import static org.fest.assertions.Assertions.assertThat;
+
+public class SimpleGetRequestTest {
+
+ @Test
+ public void method() throws Exception {
+ SimpleGetRequest request = new SimpleGetRequest();
+ assertThat(request.method()).isEqualTo("GET");
+
+ request.setParam("foo", "bar");
+ assertThat(request.param("foo")).isEqualTo("bar");
+ assertThat(request.param("unknown")).isNull();
+ }
+}
diff --git a/sonar-server/src/main/java/org/sonar/server/charts/deprecated/CustomBarChart.java b/sonar-server/src/main/java/org/sonar/server/charts/deprecated/CustomBarChart.java
index 260c4930277..4541ce07895 100644
--- a/sonar-server/src/main/java/org/sonar/server/charts/deprecated/CustomBarChart.java
+++ b/sonar-server/src/main/java/org/sonar/server/charts/deprecated/CustomBarChart.java
@@ -115,7 +115,7 @@ public class CustomBarChart extends BarChart {
} else {
categoriesSplit = new String[nbValues];
for (int i = 0; i < nbValues; i++) {
- categoriesSplit[i] = DEFAULT_NAME_CATEGORY + i;
+ categoriesSplit[i] = new StringBuilder().append(DEFAULT_NAME_CATEGORY).append(i).toString();
}
}
diff --git a/sonar-server/src/main/java/org/sonar/server/db/migrations/v44/ChangeLogMigration.java b/sonar-server/src/main/java/org/sonar/server/db/migrations/v44/ChangeLogMigration.java
index 2a3f67432d8..a92f0983af6 100644
--- a/sonar-server/src/main/java/org/sonar/server/db/migrations/v44/ChangeLogMigration.java
+++ b/sonar-server/src/main/java/org/sonar/server/db/migrations/v44/ChangeLogMigration.java
@@ -109,10 +109,10 @@ public class ChangeLogMigration implements DatabaseMigration {
private void processRuleChange(ActiveRuleChange ruleChange, ChangeLog change) {
ruleChange.setSeverity(SeverityUtil.getSeverityFromOrdinal(change.getSeverity()));
- String param_name = change.getParamKey();
- String param_value = change.getParamValue();
- if (StringUtils.isNotEmpty(param_name)) {
- ruleChange.setParameter(param_name, param_value);
+ String paramName = change.getParamKey();
+ String paramValue = change.getParamValue();
+ if (StringUtils.isNotEmpty(paramName)) {
+ ruleChange.setParameter(paramName, paramValue);
}
}
diff --git a/sonar-server/src/main/java/org/sonar/server/duplication/ws/DuplicationsParser.java b/sonar-server/src/main/java/org/sonar/server/duplication/ws/DuplicationsParser.java
index 3e206296000..fd448b98f91 100644
--- a/sonar-server/src/main/java/org/sonar/server/duplication/ws/DuplicationsParser.java
+++ b/sonar-server/src/main/java/org/sonar/server/duplication/ws/DuplicationsParser.java
@@ -145,7 +145,7 @@ public class DuplicationsParser implements ServerComponent {
}
}
- private static class BlockComparator implements Comparator<Block> {
+ private static class BlockComparator implements Comparator<Block>, Serializable {
@Override
public int compare(@Nullable Block b1,
@Nullable Block b2) {
diff --git a/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/RuleActivationActions.java b/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/RuleActivationActions.java
index b89ebbc5a3a..efa0e1bca12 100644
--- a/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/RuleActivationActions.java
+++ b/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/RuleActivationActions.java
@@ -117,7 +117,7 @@ public class RuleActivationActions implements ServerComponent {
if (params != null) {
activation.setParameters(KeyValueFormat.parse(params));
}
- activation.setReset(request.paramAsBoolean(RESET) == Boolean.TRUE);
+ activation.setReset(Boolean.TRUE.equals(request.paramAsBoolean(RESET)));
service.activate(request.mandatoryParam(PROFILE_KEY), activation);
}
diff --git a/sonar-server/src/main/java/org/sonar/server/rule/index/RuleDoc.java b/sonar-server/src/main/java/org/sonar/server/rule/index/RuleDoc.java
index 0ff56b58ae1..b90b835440a 100644
--- a/sonar-server/src/main/java/org/sonar/server/rule/index/RuleDoc.java
+++ b/sonar-server/src/main/java/org/sonar/server/rule/index/RuleDoc.java
@@ -136,16 +136,10 @@ public class RuleDoc extends BaseDoc implements Rule {
@Override
public List<RuleParam> params() {
List<RuleParam> params = new ArrayList<RuleParam>();
- List<Map<String, Object>> esParams = getNullableField(RuleNormalizer.RuleField.PARAMS.field());
+ final List<Map<String, Object>> esParams = getNullableField(RuleNormalizer.RuleField.PARAMS.field());
if (esParams != null) {
for (final Map<String, Object> esParam : esParams) {
params.add(new RuleParam() {
- {
- this.fields = esParam;
- }
-
- Map<String, Object> fields;
-
@Override
public String key() {
return (String) esParam.get(RuleNormalizer.RuleParamField.NAME.field());
@@ -163,8 +157,7 @@ public class RuleDoc extends BaseDoc implements Rule {
@Override
public RuleParamType type() {
- return RuleParamType
- .parse((String) esParam.get(RuleNormalizer.RuleParamField.TYPE.field()));
+ return RuleParamType.parse((String) esParam.get(RuleNormalizer.RuleParamField.TYPE.field()));
}
});
}
diff --git a/sonar-server/src/main/java/org/sonar/server/rule/index/RuleIndex.java b/sonar-server/src/main/java/org/sonar/server/rule/index/RuleIndex.java
index 22b272b72cd..a6bc91a3213 100644
--- a/sonar-server/src/main/java/org/sonar/server/rule/index/RuleIndex.java
+++ b/sonar-server/src/main/java/org/sonar/server/rule/index/RuleIndex.java
@@ -228,7 +228,8 @@ public class RuleIndex extends BaseIndex<Rule, RuleDto, RuleKey> {
this.addTermFilter(fb, RuleNormalizer.RuleField._TAGS.field(), query.getTags());
// Construct the debt filter on effective char and subChar
- if (query.getDebtCharacteristics() != null && !query.getDebtCharacteristics().isEmpty()) {
+ Collection<String> characteristics = query.getDebtCharacteristics();
+ if (characteristics != null && !characteristics.isEmpty()) {
fb.must(
FilterBuilders.orFilter(
// Match only when NOT NONE overriden
@@ -236,8 +237,8 @@ public class RuleIndex extends BaseIndex<Rule, RuleDto, RuleKey> {
FilterBuilders.notFilter(
FilterBuilders.termsFilter(RuleNormalizer.RuleField.SUB_CHARACTERISTIC.field(), DebtCharacteristic.NONE)),
FilterBuilders.orFilter(
- FilterBuilders.termsFilter(RuleNormalizer.RuleField.SUB_CHARACTERISTIC.field(), query.getDebtCharacteristics()),
- FilterBuilders.termsFilter(RuleNormalizer.RuleField.CHARACTERISTIC.field(), query.getDebtCharacteristics()))
+ FilterBuilders.termsFilter(RuleNormalizer.RuleField.SUB_CHARACTERISTIC.field(), characteristics),
+ FilterBuilders.termsFilter(RuleNormalizer.RuleField.CHARACTERISTIC.field(), characteristics))
),
// Match only when NOT NONE overriden
@@ -246,14 +247,14 @@ public class RuleIndex extends BaseIndex<Rule, RuleDto, RuleKey> {
FilterBuilders.termsFilter(RuleNormalizer.RuleField.SUB_CHARACTERISTIC.field(), ""),
FilterBuilders.notFilter(FilterBuilders.existsFilter(RuleNormalizer.RuleField.SUB_CHARACTERISTIC.field()))),
FilterBuilders.orFilter(
- FilterBuilders.termsFilter(RuleNormalizer.RuleField.DEFAULT_SUB_CHARACTERISTIC.field(), query.getDebtCharacteristics()),
- FilterBuilders.termsFilter(RuleNormalizer.RuleField.DEFAULT_CHARACTERISTIC.field(), query.getDebtCharacteristics())))
+ FilterBuilders.termsFilter(RuleNormalizer.RuleField.DEFAULT_SUB_CHARACTERISTIC.field(), characteristics),
+ FilterBuilders.termsFilter(RuleNormalizer.RuleField.DEFAULT_CHARACTERISTIC.field(), characteristics)))
)
);
}
// Debt char exist filter
- if (query.getHasDebtCharacteristic() != null && query.getHasDebtCharacteristic()) {
+ if (Boolean.TRUE.equals(query.getHasDebtCharacteristic())) {
fb.must(FilterBuilders.existsFilter(RuleNormalizer.RuleField.SUB_CHARACTERISTIC.field()));
}
@@ -262,9 +263,10 @@ public class RuleIndex extends BaseIndex<Rule, RuleDto, RuleKey> {
.gte(query.getAvailableSince()));
}
- if (query.getStatuses() != null && !query.getStatuses().isEmpty()) {
+ Collection<RuleStatus> statuses = query.getStatuses();
+ if (statuses != null && !statuses.isEmpty()) {
Collection<String> stringStatus = new ArrayList<String>();
- for (RuleStatus status : query.getStatuses()) {
+ for (RuleStatus status : statuses) {
stringStatus.add(status.name());
}
this.addTermFilter(fb, RuleNormalizer.RuleField.STATUS.field(), stringStatus);
@@ -391,6 +393,9 @@ public class RuleIndex extends BaseIndex<Rule, RuleDto, RuleKey> {
return tags;
}
+ /**
+ * @deprecated do not use ids but keys
+ */
@Deprecated
@CheckForNull
public Rule getById(int id) {
@@ -407,6 +412,9 @@ public class RuleIndex extends BaseIndex<Rule, RuleDto, RuleKey> {
}
}
+ /**
+ * @deprecated do not use ids but keys
+ */
@Deprecated
public List<Rule> getByIds(Collection<Integer> ids) {
SearchResponse response = getClient().prepareSearch(this.getIndexName())
diff --git a/sonar-server/src/main/java/org/sonar/server/search/IndexSynchronizer.java b/sonar-server/src/main/java/org/sonar/server/search/IndexSynchronizer.java
index 887b92abba3..0bb354aa314 100644
--- a/sonar-server/src/main/java/org/sonar/server/search/IndexSynchronizer.java
+++ b/sonar-server/src/main/java/org/sonar/server/search/IndexSynchronizer.java
@@ -60,6 +60,6 @@ public class IndexSynchronizer {
long start = System.currentTimeMillis();
dao.synchronizeAfter(session,
index.getLastSynchronization());
- LOG.info("-- Synchronized {} in {}ms", index.getIndexType(), (System.currentTimeMillis() - start));
+ LOG.info("-- Synchronized {} in {}ms", index.getIndexType(), System.currentTimeMillis() - start);
}
}
diff --git a/sonar-server/src/main/java/org/sonar/server/startup/RegisterNewMeasureFilters.java b/sonar-server/src/main/java/org/sonar/server/startup/RegisterNewMeasureFilters.java
index 755a1eed6a6..84c53745e9b 100644
--- a/sonar-server/src/main/java/org/sonar/server/startup/RegisterNewMeasureFilters.java
+++ b/sonar-server/src/main/java/org/sonar/server/startup/RegisterNewMeasureFilters.java
@@ -149,11 +149,11 @@ public final class RegisterNewMeasureFilters {
private static void appendColumns(Filter filter, List<String> fields) {
List<String> columnFields = Lists.newArrayList();
for (FilterColumn column : filter.getColumns()) {
- String columnKey = column.getFamily();
+ StringBuilder columnKey = new StringBuilder().append(column.getFamily());
if (StringUtils.isNotBlank(column.getKey()) && !column.isVariation()) {
- columnKey += ":" + column.getKey();
+ columnKey.append(":").append(column.getKey());
}
- columnFields.add(columnKey);
+ columnFields.add(columnKey.toString());
}
if (!columnFields.isEmpty()) {
fields.add("cols=" + Joiner.on(",").join(columnFields));