From bfdd643a9985ff9ab9503072967d3e871f522da0 Mon Sep 17 00:00:00 2001 From: hns Date: Fri, 1 Dec 2006 13:21:23 +0000 Subject: [PATCH] * Make Property.compareTo() immune against float/integer confusion, which is quite common in rhino. --- src/helma/objectmodel/db/Property.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/helma/objectmodel/db/Property.java b/src/helma/objectmodel/db/Property.java index 24250e1b..d378225b 100644 --- a/src/helma/objectmodel/db/Property.java +++ b/src/helma/objectmodel/db/Property.java @@ -513,6 +513,9 @@ public final class Property implements IProperty, Serializable, Cloneable, Compa return -1; } if (type != ptype) { + // float/integer sometimes get mixed up in Rhino + if ((type == FLOAT && ptype == INTEGER) || (type == INTEGER && ptype == FLOAT)) + return Double.compare(((Number) value).doubleValue(), ((Number) pvalue).doubleValue()); throw new ClassCastException("uncomparable values " + this + "(" + type + ") : " + p + "(" + ptype + ")"); }