mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Added missing testcase, part of RM-2343. Test ensures that whitespace-only values for 'classified by' result in a 4xx HTTP response.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@108248 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -343,4 +343,28 @@ public final class WebScriptUtils
|
||||
|
||||
return jsonArray;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@code true} if the provided {@link WebScriptException}
|
||||
* represents an HTTP 4xx error, else {@code false}.
|
||||
*/
|
||||
public static boolean is4xxError(WebScriptException e)
|
||||
{
|
||||
return isStatusInRange(e, 400, 500);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@code true} if the provided {@link WebScriptException}
|
||||
* represents an HTTP 5xx error, else {@code false}.
|
||||
*/
|
||||
public static boolean is5xxError(WebScriptException e)
|
||||
{
|
||||
return isStatusInRange(e, 500, 600);
|
||||
}
|
||||
|
||||
private static boolean isStatusInRange(WebScriptException e, int lowerLimitInclusive, int upperLimitExclusive)
|
||||
{
|
||||
final int status = e.getStatus();
|
||||
return status >= lowerLimitInclusive && status < upperLimitExclusive;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user