We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
反序列化BigDecimal时变成了负数,fastjson 1.2.83无此问题
import com.alibaba.fastjson2.JSON; import org.junit.jupiter.api.Test; import java.math.BigDecimal; import static org.junit.jupiter.api.Assertions.assertEquals; public class Issue1204Mutated_504 { @Test public void testMutated() throws Exception { BigDecimal decimal = BigDecimal.valueOf(Long.MAX_VALUE).add(BigDecimal.ONE); String str = JSON.toJSONString(decimal); assertEquals("9223372036854775808", str); BigDecimal decimal1 = (BigDecimal) JSON.parseObject(str,BigDecimal.class); assertEquals(decimal.stripTrailingZeros(), decimal1); } @Test public void testMutated1() throws Exception { BigDecimal decimal = BigDecimal.valueOf(Long.MAX_VALUE).add(BigDecimal.TEN); String str = JSON.toJSONString(decimal); assertEquals("9223372036854775817", str); BigDecimal decimal1 = (BigDecimal) JSON.parseObject(str,BigDecimal.class); assertEquals(decimal.stripTrailingZeros(), decimal1); } @Test public void testMutate1() throws Exception { // 1.2.83 BigDecimal decimal = BigDecimal.valueOf(Long.MAX_VALUE).add(BigDecimal.ONE); String str = com.alibaba.fastjson.JSON.toJSONString(decimal); assertEquals("9223372036854775808", str); BigDecimal decimal1 = (BigDecimal) com.alibaba.fastjson.JSON.parseObject(str,BigDecimal.class); assertEquals(decimal.stripTrailingZeros(), decimal1); } }
9223372036854775808
org.opentest4j.AssertionFailedError: Expected :9223372036854775808 Actual :-9223372036854775808
The text was updated successfully, but these errors were encountered:
fix long overflow for readBigDecimal for issue #2582
952e502
4d045f1
https://oss.sonatype.org/content/repositories/snapshots/com/alibaba/fastjson2/fastjson2/2.0.51-SNAPSHOT/ 问题已修复,请帮忙用2.0.51-SNAPSHOT版本验证
Sorry, something went wrong.
验证已修复,辛苦温少
https://github.com/alibaba/fastjson2/releases/tag/2.0.51 问题已修复,请用新版本
yanxutao89
No branches or pull requests
问题描述
反序列化BigDecimal时变成了负数,fastjson 1.2.83无此问题
环境信息
重现步骤
期待的正确结果
9223372036854775808
相关日志输出
org.opentest4j.AssertionFailedError:
Expected :9223372036854775808
Actual :-9223372036854775808
The text was updated successfully, but these errors were encountered: