You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
elseif(valueinstanceofBigDecimal) {
writeOctet('D');
BigDecimaldecimal = (BigDecimal)value;
writeOctet(decimal.scale());
BigIntegerunscaled = decimal.unscaledValue();
if(unscaled.bitLength() > 32) /*Integer.SIZE in Java 1.5*/thrownewIllegalArgumentException
("BigDecimal too large to be encoded");
writeLong(decimal.unscaledValue().intValue());
}
but 32 is actually too permissive. It should be 31 because bitLength ignores the sign bit, meaning that writing new BigDecimal(Integer.Max_Value).add(new BigDecimal(1)) "works" (that is no exception is thrown) and yields a different number back when you read it back using ValueReader.