Fixing a dodgy line of code in SiteServiceImpl which I don't believe can cause a bug today, but exposes us to a bug in the future.

A java.util.Comparator.compare result was being compared to 1, which worked because the Comparator implementation we ship returns -1, 0 or 1. But the method contract is actually -ve, 0, +ve - so I've changed the comparison to that, which is safer.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@88056 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Neil McErlean
2014-10-14 13:46:36 +00:00
parent b652eb89c5
commit e46f48b586

View File

@@ -2107,7 +2107,7 @@ public class SiteServiceImpl extends AbstractLifecycleBean implements SiteServic
{
int index = members.indexOf(memberInfo);
int priority = roleComparator.compare(members.get(index).getMemberRole(), memberInfo.getMemberRole());
if (priority == 1)
if (priority > 0)
{
members.set(index, memberInfo);
}