We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d00d84f commit fe58bd6Copy full SHA for fe58bd6
src/main/java/com/rabbitmq/client/impl/ValueWriter.java
@@ -145,7 +145,9 @@ else if(value instanceof BigDecimal) {
145
BigDecimal decimal = (BigDecimal)value;
146
writeOctet(decimal.scale());
147
BigInteger unscaled = decimal.unscaledValue();
148
- if(unscaled.bitLength() > 32) /*Integer.SIZE in Java 1.5*/
+ // We use 31 instead of 32 because bitLength ignores the sign bit,
149
+ // so e.g. new BigDecimal(Integer.MAX_VALUE) comes out to 31 bits.
150
+ if(unscaled.bitLength() > 31) /*Integer.SIZE in Java 1.5*/
151
throw new IllegalArgumentException
152
("BigDecimal too large to be encoded");
153
writeLong(decimal.unscaledValue().intValue());
0 commit comments