Permalink
Browse files

entitlement: fix repair tests with jdk7

The behavior of TreeMap has changed, see comment.

Signed-off-by: Pierre-Alexandre Meyer <pierre@ning.com>
  • Loading branch information...
pierre committed Feb 15, 2013
1 parent 24c6168 commit e0487737ad2f7bb0fc79997e9c10cf2b2d361ec1
@@ -93,6 +93,14 @@ public SubscriptionRepairEvent(final List<EntitlementEvent> initialEvents) {
this.events = new TreeSet<EntitlementEventWithOrderingId>(new Comparator<EntitlementEventWithOrderingId>() {
@Override
public int compare(final EntitlementEventWithOrderingId o1, final EntitlementEventWithOrderingId o2) {
// Work around jdk7 change: compare(o1, o1) is now invoked when inserting the first element
// See:
// - http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5045147
// - http://hg.openjdk.java.net/jdk7/tl/jdk/rev/bf37edb38fbb
if (o1 == o2) {
return 0;
}
final int result = o1.getEvent().getEffectiveDate().compareTo(o2.getEvent().getEffectiveDate());
if (result == 0) {
if (o1.getOrderingId() < o2.getOrderingId()) {

0 comments on commit e048773

Please sign in to comment.