Change in ovirt-engine[master]: webadmin: Fix SharedMacPoolComparator

Code Review gerrit at ovirt.org
Fri Mar 31 18:31:33 UTC 2017


>From Allon Mureinik <amureini at redhat.com>:

Allon Mureinik has submitted this change and it was merged.

Change subject: webadmin: Fix SharedMacPoolComparator
......................................................................


webadmin: Fix SharedMacPoolComparator

A Comparator's general contract states that:

```
The implementor must ensure that
sgn(compare(x, y)) == -sgn(compare(y, x)) for all x and y.
```

SharedMacPoolComparator breaks this assumption for the case of
comparing two default MacPools. While this may not currently be
possible, it's a bad practice to implement a Comparator in a way that
blatantly breaks Java's contract.

This patch remimplements this Comparator in a way that adheres to
Java's contract and still upholds the intended logic:
1. Default MacPools come first
2. Within each class of "is [not] default", the MacPools
   are sorted lexonumerically by their name.

Change-Id: I9477988dcb680e8d843e8399a4f08a95553e91c1
Signed-off-by: Allon Mureinik <amureini at redhat.com>
---
M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/Linq.java
1 file changed, 4 insertions(+), 6 deletions(-)

Approvals:
  Martin Mucha: Looks good to me, but someone else must approve
  Jenkins CI: Passed CI tests
  Allon Mureinik: Verified
  Vojtech Szocs: Looks good to me, approved



-- 
To view, visit https://gerrit.ovirt.org/74948
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I9477988dcb680e8d843e8399a4f08a95553e91c1
Gerrit-PatchSet: 4
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Allon Mureinik <amureini at redhat.com>
Gerrit-Reviewer: Allon Mureinik <amureini at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Martin Mucha <mmucha at redhat.com>
Gerrit-Reviewer: Tal Nisan <tnisan at redhat.com>
Gerrit-Reviewer: Vojtech Szocs <vszocs at redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation at ovirt.org>


More information about the Engine-commits mailing list