From cf5621c60850a342757bf146612fda9c34ce3756 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Lievremont Date: Mon, 30 Mar 2015 10:35:10 +0200 Subject: [PATCH] Fix regression on issue paging with one component --- .../java/org/sonar/server/issue/ws/SearchAction.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/ws/SearchAction.java b/server/sonar-server/src/main/java/org/sonar/server/issue/ws/SearchAction.java index 9898640cb76..b11bda5e624 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/issue/ws/SearchAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/issue/ws/SearchAction.java @@ -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 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 execute(IssueQuery query, SearchOptions options) { Collection components = query.componentUuids(); if (components != null && components.size() == 1 && BooleanUtils.isTrue(query.ignorePaging())) { -- 2.39.5