mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-21 18:09:20 +00:00
Merged 5.2.N (5.2.1) to HEAD (5.2)
129701 mmuller: Add a specific error message for the maxItem=0. REPO-890 git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@130218 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -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<br/>
|
* skipCount - How many entries exist in the entire collection before those included in the list<br/>
|
||||||
* maxItems - The maximum number of items the client requires. Defaults to 100.
|
* maxItems - The maximum number of items the client requires. Defaults to 100.
|
||||||
*
|
*
|
||||||
* @author Gethin James
|
* @author Gethin James, Martin Muller (mmuller)
|
||||||
*/
|
*/
|
||||||
public class Paging
|
public class Paging
|
||||||
{
|
{
|
||||||
@@ -49,11 +49,11 @@ public class Paging
|
|||||||
super();
|
super();
|
||||||
if(skipCount < 0)
|
if(skipCount < 0)
|
||||||
{
|
{
|
||||||
throw new InvalidArgumentException();
|
throw new InvalidArgumentException("Negative values not supported for skipCount.");
|
||||||
}
|
}
|
||||||
if(maxItems < 1)
|
if(maxItems < 1)
|
||||||
{
|
{
|
||||||
throw new InvalidArgumentException();
|
throw new InvalidArgumentException("Only positive values supported for maxItems.");
|
||||||
}
|
}
|
||||||
this.skipCount = skipCount;
|
this.skipCount = skipCount;
|
||||||
this.maxItems = maxItems;
|
this.maxItems = maxItems;
|
||||||
|
@@ -787,9 +787,13 @@ public class ResourceWebScriptHelper
|
|||||||
{
|
{
|
||||||
if (skip != null) { skipped = Integer.parseInt(skip);}
|
if (skip != null) { skipped = Integer.parseInt(skip);}
|
||||||
if (maxItems != null) { max = Integer.parseInt(maxItems); }
|
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)
|
catch (NumberFormatException error)
|
||||||
|
Reference in New Issue
Block a user