Exception while unmarshalling Integer with an element bigger than 32-bit

Chad La Joie lajoie at shibboleth.net
Tue Jun 5 20:48:53 BST 2012



On 6/4/12 11:35 PM, Brent Putman wrote:
> Also, if XMLSchema does define xsd:integer as having an infinite value
> domain as you say, then using java.lang.Long wouldn't really be any more
> correct, it would just put off the problem until even bigger numbers are
> used (although if we're really lucky maybe that won't be until the heat
> death of the universe).

Yeah, I checked the spec, integer is in fact defined to be the infinite
set of all whole numbers.  Which leads to the idiosyncratic definition
of 'long' being a smaller set of numbers (-9223372036854775808 -
9223372036854775807).

> I hate to even go there, but if the value space is infinite, seems like
> in the future we might have to consider using another integer
> representation capable of representing arbitrarily large integers. 
> java.math.BigInteger seems like overkill, but perhaps there is another
> library with a simply class that might help us.  Or maybe just using
> Long would be "good enough", even if not strictly speaking correct.

In OSv3, I recommend we move to longs.  It's not "infinite", and it'll
probably bite us at some point, but things like BigInteger just seem
like a bad idea for this.


More information about the users mailing list