groovy

OrderBy Comparable Check

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.0
  • Fix Version/s: 1.5.2
  • Component/s: None
  • Labels:
    None
  • Testcase included:
    yes
  • Number of attachments :
    1

Description

The OrderBy implemented method public int compare(Object o1, Object o2) was not accounting for Comparable equality. The code added is inside the if(value1 instanceof Comparable) clause. The original version of the code would return the value of compareTo regardless, whereas the change accounts for equality and calls continue in that case.

if (value1 instanceof Comparable) {
Comparable c1 = (Comparable) value1;
int result = c1.compareTo(value2);
if (result == 0) { continue; } else { return result; }
}

Activity

Hide
Tony Lauro added a comment -

I am only submitting code for Rod Cope.

Show
Tony Lauro added a comment - I am only submitting code for Rod Cope.
Hide
Paul King added a comment -

Patch applied, Thanks. Please pass thanks on to Rod too.

Show
Paul King added a comment - Patch applied, Thanks. Please pass thanks on to Rod too.
Hide
Paul King added a comment -

close off release 1.5.4

Show
Paul King added a comment - close off release 1.5.4

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: