Merged V3.4-BUG-FIX to HEAD

28143: ALF-8602: Prevent integer overflow in batch size calculation of PatchDAOImpl.getChildAssocsForCrcFix()


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@28151 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Dave Ward
2011-06-01 19:36:34 +00:00
parent de41d53b53
commit 02e3d817de

View File

@@ -424,9 +424,15 @@ public class PatchDAOImpl extends AbstractPatchDAOImpl
// requery using the previous maxAssocId // requery using the previous maxAssocId
minAssocId = maxAssocId; minAssocId = maxAssocId;
// Double the range multiplier if we have a low hit-rate (<50% of desired size) // Double the range multiplier if we have a low hit-rate (<50% of desired size)
// and we can avoid integer overflow
if (rows.size() < queryMaxResults / 2 ) if (rows.size() < queryMaxResults / 2 )
{ {
rangeMultiplier *= 2L; long newRangeMultiplier = rangeMultiplier * 2L;
long newIdRange = maxResults * newRangeMultiplier;
if (newIdRange > 0 && newIdRange < maxIdRange)
{
rangeMultiplier = newRangeMultiplier;
}
} }
} }
catch (Throwable e) catch (Throwable e)