commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stefano masiero <stefano.masi...@gmail.com>
Subject [jxpath] - Is it possible to override Number comparison in CoreOperationCompare?
Date Fri, 21 Sep 2012 15:33:31 GMT
Hi all!
First of all sorry for my english!

I'm using jxpath-1.2 since 2009 in production environment.

I'm a great fan of jxpath and I'm using it in a dao framework to load xml
files and run xpath queries on them.

I've a problem using filter expressions on an xml element of type decimal
(mapped on a BigDecimal) exceed 18 digits.

I'm expecting one object as result of the query but I've two.

The problem is at the line 131 of the method equal in the class
org.apache.commons.jxpath.ri.compiler.CoreOperationCompare:

        else if (l instanceof Number || r instanceof Number) {
            return (InfoSetUtil.doubleValue(l) ==
InfoSetUtil.doubleValue(r));
        }

These are the two BigDecimal that the query has to compare:
l = 4618200845616818081
r = 4618200845616818593
and the method returns true :(

I've understand that the problem is the conversion to double type.
How I can override this method without implementing a new compiler?

If I can, do you see side effects in using the compareTo?

Thanks in advance for any help.

Stefano

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message