From f576673dad31837af0a31920ec45a7c3f536a701 Mon Sep 17 00:00:00 2001 From: null Date: Thu, 12 Oct 2023 05:06:54 +0000 Subject: [PATCH] I changed the string to a constant. --- .../main/java/org/eclipse/che/api/core/Page.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/core/che-core-api-core/src/main/java/org/eclipse/che/api/core/Page.java b/core/che-core-api-core/src/main/java/org/eclipse/che/api/core/Page.java index 193afb3ed4..bcbebbcf2c 100644 --- a/core/che-core-api-core/src/main/java/org/eclipse/che/api/core/Page.java +++ b/core/che-core-api-core/src/main/java/org/eclipse/che/api/core/Page.java @@ -91,6 +91,11 @@ public class Page { private final long totalCount; private final List items; + final String nonNullItemsString = "Required non-null items"; + final String nonNegativeValueOfItems = "Required non-negative value of items before"; + final String positiveValueOfPageSize = "Required positive value of page size"; + final String nonNegativeValueOfTotalItems = "Required non-negative value of total items"; + /** * Creates a new page. * @@ -104,13 +109,13 @@ public class Page { * @throws IllegalArgumentException when {@code totalCount} is negative */ public Page(Collection items, long itemsBefore, int pageSize, long totalCount) { - requireNonNull(items, "Required non-null items"); + requireNonNull(items, nonNullItemsString); this.items = new ArrayList<>(items); - checkArgument(itemsBefore >= 0, "Required non-negative value of items before"); + checkArgument(itemsBefore >= 0, nonNegativeValueOfItems); this.itemsBefore = itemsBefore; - checkArgument(pageSize > 0, "Required positive value of page size"); + checkArgument(pageSize > 0, positiveValueOfPageSize); this.pageSize = pageSize; - checkArgument(totalCount >= 0, "Required non-negative value of total items"); + checkArgument(totalCount >= 0, nonNegativeValueOfTotalItems); this.totalCount = totalCount; }