SPR-7840: comparator dealing with nulls

This commit is contained in:
Andy Clement
2011-04-01 18:51:35 +00:00
parent fadfc76443
commit b9d07b9c47
3 changed files with 49 additions and 5 deletions

View File

@@ -33,9 +33,9 @@ public class StandardTypeComparator implements TypeComparator {
public int compare(Object left, Object right) throws SpelEvaluationException {
// If one is null, check if the other is
if (left == null) {
return right == null ? 0 : 1;
return right == null ? 0 : -1;
} else if (right == null) {
return -1; // left cannot be null
return 1; // left cannot be null
}
// Basic number comparisons