diff --git a/source/java/org/alfresco/rest/framework/resource/parameters/Paging.java b/source/java/org/alfresco/rest/framework/resource/parameters/Paging.java index e4797938d4..3f4db5f3d7 100644 --- a/source/java/org/alfresco/rest/framework/resource/parameters/Paging.java +++ b/source/java/org/alfresco/rest/framework/resource/parameters/Paging.java @@ -32,7 +32,7 @@ import org.alfresco.rest.framework.core.exceptions.InvalidArgumentException; * skipCount - How many entries exist in the entire collection before those included in the list
* maxItems - The maximum number of items the client requires. Defaults to 100. * - * @author Gethin James + * @author Gethin James, Martin Muller (mmuller) */ public class Paging { @@ -49,11 +49,11 @@ public class Paging super(); if(skipCount < 0) { - throw new InvalidArgumentException(); + throw new InvalidArgumentException("Negative values not supported for skipCount."); } if(maxItems < 1) { - throw new InvalidArgumentException(); + throw new InvalidArgumentException("Only positive values supported for maxItems."); } this.skipCount = skipCount; this.maxItems = maxItems; diff --git a/source/java/org/alfresco/rest/framework/webscripts/ResourceWebScriptHelper.java b/source/java/org/alfresco/rest/framework/webscripts/ResourceWebScriptHelper.java index df1b194412..3174c10229 100644 --- a/source/java/org/alfresco/rest/framework/webscripts/ResourceWebScriptHelper.java +++ b/source/java/org/alfresco/rest/framework/webscripts/ResourceWebScriptHelper.java @@ -787,9 +787,13 @@ public class ResourceWebScriptHelper { if (skip != null) { skipped = Integer.parseInt(skip);} if (maxItems != null) { max = Integer.parseInt(maxItems); } - if (max < 0 || skipped < 0) + if (skipped < 0) { - throw new InvalidArgumentException("Negative values not supported."); + throw new InvalidArgumentException("Negative values not supported for skipCount."); + } + if (max < 1) + { + throw new InvalidArgumentException("Only positive values supported for maxItems."); } } catch (NumberFormatException error)