Alessio Fabiani a écrit :
public boolean evaluate(Feature feature) {
Object value1 = eval( expression1, feature ); Object value2 = eval( expression2, feature );
        if (value1 instanceof Long) {
            value1 = new Integer(((Long)value1).intValue());
        }

        if (value2 instanceof Long) {
            value2 = new Integer(((Long)value2).intValue());
        }

        return (value1 == null && value2 == null) ||
                value1 != null && value1.equals( value2 );
    }


Casting a long to an int before the comparaison may lead to inexact results if the long values required more than 32 bits... A possible approach is to add the following check:

if (value1 instanceof Long) {
    long v = ((Long)value1).longValue();
    if (v >= Integer.MIN_VALUE && v <= Integer.MAX_VALUE) {
        value1 = new Integer((int) v);
    }
}

    Martin.


-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0709&bid&3057&dat1642
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to