mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-08 14:51:49 +00:00
MNT-17001: Handle overflow condition; improve test to cover
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@133189 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -471,6 +471,10 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
|
||||
{
|
||||
throw new IllegalArgumentException("The default maximum number of content changes to retrieve must be greater than zero.");
|
||||
}
|
||||
else if (contentChangesDefaultMaxItems == Integer.MAX_VALUE)
|
||||
{
|
||||
throw new IllegalArgumentException("The server cannot return " + Integer.MAX_VALUE + " content changes in a request!");
|
||||
}
|
||||
this.contentChangesDefaultMaxItems = contentChangesDefaultMaxItems;
|
||||
}
|
||||
|
||||
@@ -3697,9 +3701,12 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
|
||||
params.setApplicationName(CMIS_CHANGELOG_AUDIT_APPLICATION);
|
||||
params.setForward(true);
|
||||
params.setFromId(from);
|
||||
|
||||
|
||||
// So we have a BigInteger. We need to ensure that we cut it down to an integer smaller than Integer.MAX_VALUE
|
||||
|
||||
int maxResults = (maxItems == null ? contentChangesDefaultMaxItems : maxItems.intValue());
|
||||
maxResults = maxResults < 1 ? contentChangesDefaultMaxItems : maxResults; // Just a double check of the unbundled contents
|
||||
maxResults = maxResults > contentChangesDefaultMaxItems ? contentChangesDefaultMaxItems : maxResults; // cut it down
|
||||
int queryFor = maxResults + 1; // Query for 1 more so that we know if there are more results
|
||||
|
||||
auditService.auditQuery(changeLogCollectingCallback, params, queryFor);
|
||||
|
Reference in New Issue
Block a user