aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api
diff options
context:
space:
mode:
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>2017-02-17 16:19:57 +0100
committerSébastien Lesaint <sebastien.lesaint@sonarsource.com>2017-02-17 16:23:24 +0100
commitfa327b38613d18ec445831242f84d500bf284ac3 (patch)
tree940811204fae4b23fd53a067a72b64d1cfd902c3 /sonar-plugin-api
parentf4039bbb34726f62ee61e45503c2bfa6c87dc3fb (diff)
parent3b673b37f88fc38b84244bd541d20ee9ac510486 (diff)
downloadsonarqube-fa327b38613d18ec445831242f84d500bf284ac3.tar.gz
sonarqube-fa327b38613d18ec445831242f84d500bf284ac3.zip
Merge branch 'branch-6.3'
Diffstat (limited to 'sonar-plugin-api')
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/utils/Paging.java15
1 files changed, 5 insertions, 10 deletions
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;