Exception while unmarshalling Integer with an element bigger than 32-bit
Brent Putman
putmanb at georgetown.edu
Wed Jun 6 20:08:19 BST 2012
On 6/5/12 3:48 PM, Chad La Joie wrote:
>
> 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 had forgotten that there is (confusingly) both xsd:integer and
xsd:int. The former is infinite, the latter is the equivalent of a
32-bit int from the common languages. So at least in that sense
xsd:long and xsd:int are what one would expect relative to one another.
xsd:integer is the odd one.
> 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.
That was my initial gut feeling as well. However I did some checking,
and for example both JAXB and XmlBeans do by default use BigInteger for
representing xsd:integer (and int/Integer or long/Long for xsd:int and
xsd:long respectively). So there is at least some precedent for it.
I was kinda hoping that there might be some library with an arbitrary
precision integer rep in it that we could use, but haven't found one
yet. I think we should at least think on it some more. It's
intellectually somewhat hard to defend using Long since it's not any
more correct than Integer.
More information about the users
mailing list