aboutsummaryrefslogtreecommitdiffstats
path: root/server/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/main/java')
-rw-r--r--server/src/main/java/com/vaadin/data/util/filter/Compare.java12
1 files changed, 9 insertions, 3 deletions
diff --git a/server/src/main/java/com/vaadin/data/util/filter/Compare.java b/server/src/main/java/com/vaadin/data/util/filter/Compare.java
index 1fcbe85580..60523f2d42 100644
--- a/server/src/main/java/com/vaadin/data/util/filter/Compare.java
+++ b/server/src/main/java/com/vaadin/data/util/filter/Compare.java
@@ -292,9 +292,15 @@ public abstract class Compare implements Filter {
return null == value1 ? 0 : -1;
} else if (null == value1) {
return 1;
- } else if (getValue() instanceof Comparable
- && value1.getClass().isAssignableFrom(getValue().getClass())) {
- return -((Comparable) getValue()).compareTo(value1);
+ } else if (getValue() instanceof Comparable) {
+ if (value1.getClass().isInstance(getValue())) {
+ return -((Comparable) getValue()).compareTo(value1);
+ } else if (getValue().getClass().isInstance(value1)) {
+ // isInstance returns true if value1 is a sub-type of
+ // getValue(), i.e. value1 must here be Comparable
+ return ((Comparable) value1).compareTo(getValue());
+ }
+
}
throw new IllegalArgumentException("Could not compare the arguments: "
+ value1 + ", " + getValue());