dCache/dcache — pull request #336 by alrossi (2013-12-05 16:06:02+00:00)
Title: (2.6) dcache-webadmin: fix comparison semantics

Java 1.7 now enforces comparison contracts on sort, and will throw an IllegalArgument exception if the implementation of compareTo violates it.

Several comparisons used in the webadmin beans did not adhere to this contract. For instance, something like:

a.name.compareTo(b.name) + a.domain.compareTo(b.domain) is incorrect, since this could possibly result in 0 if the two parts evaluate to oppositely signed 1s, when in fact 0 should be reserved for equality.

This patch reimplements all compareTo in the bean classes, modernizing them with a call to Guava's ComparisonChain.

Testing:

Reran junit tests. Deployed and rechecked.

Target: 2.6
Patch: http://rb.dcache.org/r/6307/
Bug: http://rt.dcache.org/Ticket/Display.html?id=8145
Require-notes: yes
Require-book: no
Acked-by: Tigran
Committed: 5c788be798cae49f489a5c61163b296f52a31f4d

RELEASE NOTES:

Fixes bug which throws java.lang.IllegalArgumentException: Comparison method violates its general contract! when data is being sorted in certain webadmin pages.