From caf680a41651e04268b7bd1d26152d5428e574d9 Mon Sep 17 00:00:00 2001 From: Julien Lancelot Date: Thu, 16 Feb 2017 17:45:52 +0100 Subject: SONAR-8804 Use api/projects/search in projects admin page --- .../src/main/java/org/sonar/api/utils/Paging.java | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'sonar-plugin-api') diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/Paging.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/Paging.java index 4cc2da8bb21..2f650bffe61 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/Paging.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/Paging.java @@ -19,6 +19,8 @@ */ package org.sonar.api.utils; +import static com.google.common.base.Preconditions.checkArgument; + /** * @since 3.6 */ @@ -29,16 +31,9 @@ public class Paging { private final int total; private Paging(int pageSize, int pageIndex, int total) { - if (pageSize < 1) { - throw new IllegalArgumentException("Page size must be strictly positive. Got " + pageSize); - } - if (pageIndex < 1) { - throw new IllegalArgumentException("Page index must be strictly positive. Got " + pageIndex); - } - if (total < 0) { - throw new IllegalArgumentException("Total items must be positive. Got " + total); - } - + checkArgument(pageSize >= 1, "Page size must be strictly positive. Got %s", pageSize); + checkArgument(pageIndex >= 1, "Page index must be strictly positive. Got %s", pageIndex); + checkArgument(total >= 0, "Total items must be positive. Got %s", total); this.pageSize = pageSize; this.pageIndex = pageIndex; this.total = total; -- cgit v1.2.3