From: Jean-Baptiste Lievremont Date: Mon, 12 Jan 2015 16:54:23 +0000 (+0100) Subject: Fix quality flaws X-Git-Tag: latest-silver-master-#65~241 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=59e044daf2c6427b225f91444c34a7a0d6ef8702;p=sonarqube.git Fix quality flaws --- diff --git a/server/sonar-server/src/main/java/org/sonar/server/rule/index/RuleIndex.java b/server/sonar-server/src/main/java/org/sonar/server/rule/index/RuleIndex.java index f056364cf47..bdfca485496 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/rule/index/RuleIndex.java +++ b/server/sonar-server/src/main/java/org/sonar/server/rule/index/RuleIndex.java @@ -339,18 +339,25 @@ public class RuleIndex extends BaseIndex { StickyFacetBuilder stickyFacetBuilder = stickyFacetBuilder(queryBuilder, filters); if (options.facets().contains("languages") || options.facets().contains("true")) { - aggregations.put(FACET_LANGUAGES, // + "global", - stickyFacetBuilder.buildStickyFacet(RuleNormalizer.RuleField.LANGUAGE.field(), FACET_LANGUAGES, query.getLanguages() == null ? new String[0] : query.getLanguages().toArray())); + Collection languages = query.getLanguages(); + aggregations.put(FACET_LANGUAGES, + stickyFacetBuilder.buildStickyFacet(RuleNormalizer.RuleField.LANGUAGE.field(), FACET_LANGUAGES, + languages == null ? new String[0] : languages.toArray())); } if (options.facets().contains("tags") || options.facets().contains("true")) { - aggregations.put(FACET_TAGS, // + "global", - stickyFacetBuilder.buildStickyFacet(RuleNormalizer.RuleField.ALL_TAGS.field(), FACET_TAGS, query.getTags() == null ? new String[0] : query.getTags().toArray())); + Collection tags = query.getTags(); + aggregations.put(FACET_TAGS, + stickyFacetBuilder.buildStickyFacet(RuleNormalizer.RuleField.ALL_TAGS.field(), FACET_TAGS, + tags == null ? new String[0] : tags.toArray())); } if (options.facets().contains("repositories") || options.facets().contains("true")) { - aggregations.put(FACET_REPOSITORIES, // + "global", - stickyFacetBuilder.buildStickyFacet(RuleNormalizer.RuleField.REPOSITORY.field(), FACET_REPOSITORIES, query.getRepositories() == null ? new String[0] : query.getRepositories().toArray())); + Collection repositories = query.getRepositories(); + aggregations.put(FACET_REPOSITORIES, + stickyFacetBuilder.buildStickyFacet(RuleNormalizer.RuleField.REPOSITORY.field(), FACET_REPOSITORIES, + repositories == null ? new String[0] : repositories.toArray())); } + return aggregations; } 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 89cd40c61fe..6dd6f9890ac 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 @@ -67,7 +67,7 @@ public class SearchAction extends SearchRequestHandler { public static final String SEARCH_ACTION = "search"; - private static final Collection DEFAULT_FACETS = ImmutableSet.of("languages", "repositories", "tags"); + private static final Collection DEFAULT_FACETS = ImmutableSet.of(PARAM_LANGUAGES, PARAM_REPOSITORIES, "tags"); private final RuleService ruleService; private final ActiveRuleCompleter activeRuleCompleter; @@ -95,8 +95,8 @@ public class SearchAction extends SearchRequestHandler { @CheckForNull protected Collection possibleFacets() { return Arrays.asList(new String[] { - "languages", - "repositories", + PARAM_LANGUAGES, + PARAM_REPOSITORIES, "tags", "characteristics", "severities",