]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-7637 WS api/issues/search fix timezone related issues on createdAt facet
authorTeryk Bellahsene <teryk.bellahsene@sonarsource.com>
Tue, 17 May 2016 15:32:36 +0000 (17:32 +0200)
committerTeryk Bellahsene <teryk.bellahsene@sonarsource.com>
Tue, 17 May 2016 15:32:36 +0000 (17:32 +0200)
server/sonar-server/src/main/java/org/sonar/server/issue/index/IssueIndex.java

index e5f0e19578af975ace44e43800d7ba5d8319a416..b43203c12f17ddfc97cd044a71c7661417df5366 100644 (file)
@@ -35,6 +35,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.SortedSet;
+import java.util.TimeZone;
 import java.util.regex.Pattern;
 import javax.annotation.CheckForNull;
 import javax.annotation.Nullable;
@@ -127,9 +128,7 @@ public class IssueIndex extends BaseIndex {
     LANGUAGES,
     TAGS,
     TYPES,
-    CREATED_AT
-  );
-
+    CREATED_AT);
 
   // TODO to be documented
   // TODO move to Facets ?
@@ -461,6 +460,7 @@ public class IssueIndex extends BaseIndex {
     long now = system.now();
 
     String timeZoneString = system.getDefaultTimeZone().getID();
+    String gmtTimeZoneString = TimeZone.getTimeZone("GMT").getID();
 
     DateHistogram.Interval bucketSize = DateHistogram.Interval.YEAR;
     Date createdAfter = query.createdAfter();
@@ -483,7 +483,7 @@ public class IssueIndex extends BaseIndex {
       .interval(bucketSize)
       .minDocCount(0L)
       .format(DateUtils.DATETIME_FORMAT)
-      .timeZone(timeZoneString)
+      .timeZone(gmtTimeZoneString)
       .postZone(timeZoneString)
       .extendedBounds(startTime, endTime);
     dateHistogram = addEffortAggregationIfNeeded(query, dateHistogram);