]> source.dussan.org Git - sonarqube.git/commitdiff
Fix regression on issue paging with one component
authorJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>
Mon, 30 Mar 2015 08:35:10 +0000 (10:35 +0200)
committerJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>
Mon, 30 Mar 2015 08:35:10 +0000 (10:35 +0200)
server/sonar-server/src/main/java/org/sonar/server/issue/ws/SearchAction.java

index 9898640cb76d92642e2d2981b9db72f8d02d9383..b11bda5e624b98db275b9ce8833b217058113279 100644 (file)
@@ -270,6 +270,9 @@ public class SearchAction implements BaseIssuesWsAction {
   public final void handle(Request request, Response response) throws Exception {
     SearchOptions options = new SearchOptions();
     options.setPage(request.mandatoryParamAsInt(WebService.Param.PAGE), request.mandatoryParamAsInt(WebService.Param.PAGE_SIZE));
+    if (shouldIgnorePaging(request)) {
+      options.disableLimit();
+    }
     options.addFacets(request.paramAsStrings(WebService.Param.FACETS));
 
     IssueQuery query = issueQueryService.createFromRequest(request);
@@ -286,6 +289,13 @@ public class SearchAction implements BaseIssuesWsAction {
     json.endObject().close();
   }
 
+  private boolean shouldIgnorePaging(Request request) {
+    List<String> componentUuids = request.paramAsStrings(IssueFilterParameters.COMPONENT_UUIDS);
+    // Paging can be ignored only when querying issues for a single component (e.g in component viewer)
+    return componentUuids != null && componentUuids.size() == 1
+        && BooleanUtils.isTrue(request.paramAsBoolean(IssueFilterParameters.IGNORE_PAGING));
+  }
+
   private SearchResult<IssueDoc> execute(IssueQuery query, SearchOptions options) {
     Collection<String> components = query.componentUuids();
     if (components != null && components.size() == 1 && BooleanUtils.isTrue(query.ignorePaging())) {