]> source.dussan.org Git - sonarqube.git/commitdiff
Protect against IndexOutOfBoundsException
authorJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>
Wed, 21 Jan 2015 10:30:36 +0000 (11:30 +0100)
committerJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>
Wed, 21 Jan 2015 10:30:36 +0000 (11:30 +0100)
server/sonar-server/src/main/java/org/sonar/server/search/Result.java

index e65e6ed42341c189045244d40933f37f7324fd39..1a8563cd03bcb1153e2c429887bb48f7fe7d0e4d 100644 (file)
@@ -84,7 +84,7 @@ public class Result<K> {
       Terms termAggregation = (Terms) aggregation;
       for (Terms.Bucket value : termAggregation.getBuckets()) {
         String facetName = aggregation.getName().replace("_selected", "");
-        if (aggregation.getName().contains("__")) {
+        if (aggregation.getName().contains("__") && !aggregation.getName().startsWith("__")) {
           facetName = facetName.substring(0, facetName.indexOf("__"));
         }
         this.facets.put(facetName, new FacetValue(value.getKey(), value.getDocCount()));