Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -441,22 +441,6 @@ public void writeNumber(String encodedValue)
// There is a room to improve this API's performance while the implementation is robust.
// If users can use other MessagePackGenerator#writeNumber APIs that accept
// proper numeric types not String, it's better to use the other APIs instead.
try {
long l = Long.parseLong(encodedValue);
addValueToStackTop(l);
return;
}
catch (NumberFormatException e) {
}

try {
double d = Double.parseDouble(encodedValue);
addValueToStackTop(d);
return;
}
catch (NumberFormatException e) {
}

try {
BigInteger bi = new BigInteger(encodedValue);
addValueToStackTop(bi);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -854,7 +854,7 @@ public void serializeStringAsBigDecimal()
objectMapper.registerModule(
new SimpleModule().addSerializer(BigDecimal.class, new BigDecimalSerializerStoringAsString()));

BigDecimal bd = BigDecimal.valueOf(Long.MAX_VALUE).add(BigDecimal.ONE);
BigDecimal bd = BigDecimal.valueOf(Double.MAX_VALUE);
assertThat(
MessagePack.newDefaultUnpacker(objectMapper.writeValueAsBytes(bd)).unpackDouble(),
is(bd.doubleValue()));
Expand All @@ -881,7 +881,7 @@ public void serializeStringAsBigInteger()

BigInteger bi = BigInteger.valueOf(Long.MAX_VALUE).add(BigInteger.ONE);
assertThat(
MessagePack.newDefaultUnpacker(objectMapper.writeValueAsBytes(bi)).unpackDouble(),
is(bi.doubleValue()));
MessagePack.newDefaultUnpacker(objectMapper.writeValueAsBytes(bi)).unpackBigInteger(),
is(bi));
}
}