summaryrefslogtreecommitdiffstats
path: root/server/sonar-server
diff options
context:
space:
mode:
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>2016-03-25 16:36:11 +0100
committerSébastien Lesaint <sebastien.lesaint@sonarsource.com>2016-03-31 15:22:07 +0200
commitebc75e34c2efdbccf8efbfc34755d2fd71cb8fb8 (patch)
tree8b200123b6bf9a3b5106b314e52e6b56c27ef4b8 /server/sonar-server
parent894305bb873f56d55d4acff8a5657a1cd966ab0c (diff)
downloadsonarqube-ebc75e34c2efdbccf8efbfc34755d2fd71cb8fb8.tar.gz
sonarqube-ebc75e34c2efdbccf8efbfc34755d2fd71cb8fb8.zip
SONAR-7480 remove useless map copy
Diffstat (limited to 'server/sonar-server')
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileLoader.java9
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/SearchDataLoader.java10
2 files changed, 3 insertions, 16 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileLoader.java b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileLoader.java
index 64230d8b40b..ff63491c891 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileLoader.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileLoader.java
@@ -21,11 +21,9 @@ package org.sonar.server.qualityprofile;
import com.google.common.collect.Lists;
import com.google.common.collect.Multimap;
-import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import java.util.Set;
import javax.annotation.CheckForNull;
import org.sonar.api.rule.RuleKey;
import org.sonar.api.rule.RuleStatus;
@@ -101,12 +99,7 @@ public class QProfileLoader {
}
public Map<String, Long> countAllActiveRules() {
- Set<Map.Entry<String, Long>> entries = activeRuleIndex.countAllByQualityProfileKey().entrySet();
- Map<String, Long> counts = new HashMap<>(entries.size());
- for (Map.Entry<String, Long> entry : entries) {
- counts.put(entry.getKey(), entry.getValue());
- }
- return counts;
+ return activeRuleIndex.countAllByQualityProfileKey();
}
public Map<String, Multimap<String, FacetValue>> getAllProfileStats() {
diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/SearchDataLoader.java b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/SearchDataLoader.java
index 71348447368..cb5c848cdca 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/SearchDataLoader.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/SearchDataLoader.java
@@ -181,13 +181,13 @@ public class SearchDataLoader {
return Sets.newHashSet(Sets.difference(languageKeys, set2));
}
- private void addAllFromDto(Map<String, QProfile> qualityProfiles, Collection<QualityProfileDto> list) {
+ private static void addAllFromDto(Map<String, QProfile> qualityProfiles, Collection<QualityProfileDto> list) {
for (QualityProfileDto qualityProfileDto : list) {
qualityProfiles.put(qualityProfileDto.getLanguage(), QualityProfileDtoToQProfile.INSTANCE.apply(qualityProfileDto));
}
}
- private void addAll(Map<String, QProfile> qualityProfiles, Collection<QProfile> list) {
+ private static void addAll(Map<String, QProfile> qualityProfiles, Collection<QProfile> list) {
for (QProfile qProfile : list) {
qualityProfiles.put(qProfile.language(), qProfile);
}
@@ -197,12 +197,6 @@ public class SearchDataLoader {
return from(Arrays.asList(languages.all())).transform(LanguageToKey.INSTANCE).toSet();
}
- private List<QProfile> findDefaultProfiles(Set<String> languageKeys) {
- try (DbSession dbSession = dbClient.openSession(false)) {
- return findDefaultProfiles(dbSession, languageKeys);
- }
- }
-
private List<QProfile> findDefaultProfiles(final DbSession dbSession, Set<String> languageKeys) {
return from(profileFactory.getDefaults(dbSession, languageKeys))
.transform(QualityProfileDtoToQProfile.INSTANCE)