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

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 NetworkInClusterComparator
......................................................................


webadmin: Fix NetworkInClusterComparator

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.
```

NetworkInClusterComparator breaks this assumption for the case of
comparing two management networks. 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. Management Networks(s) come first
2. Within each class of "is [not] management network", the networks
   are sorted lexonumerically by their name.

Change-Id: I4db86c83abdd6ee79bfcf932ab4b1b35a8fae82f
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, 5 insertions(+), 4 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/74938
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I4db86c83abdd6ee79bfcf932ab4b1b35a8fae82f
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: Alona Kaplan <alkaplan 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