File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
src/test/java/com/fasterxml/jackson/core/read Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change 6
6
import com .fasterxml .jackson .core .*;
7
7
import com .fasterxml .jackson .core .json .JsonReadFeature ;
8
8
9
+ import java .math .BigDecimal ;
10
+
9
11
@ FixMethodOrder (MethodSorters .NAME_ASCENDING ) // easier to read on IDE
10
12
public class NonStandardNumberParsingTest
11
13
extends com .fasterxml .jackson .core .BaseTest
@@ -56,6 +58,20 @@ public void testNegativeHexadecimal() throws Exception {
56
58
}
57
59
}
58
60
61
+ public void testLargeDecimal () throws Exception {
62
+ final String value = "7976931348623157e309" ;
63
+ for (int mode : ALL_MODES ) {
64
+ try (JsonParser p = createParser (mode , " " + value + " " )) {
65
+ assertEquals (JsonToken .VALUE_NUMBER_FLOAT , p .nextToken ());
66
+ assertEquals (new BigDecimal (value ), p .getDecimalValue ());
67
+ assertFalse (p .isNaN ());
68
+ assertEquals (Double .POSITIVE_INFINITY , p .getValueAsDouble ());
69
+ // PJF: we might want to fix the isNaN check to not be affected by us reading the value as a double
70
+ assertTrue (p .isNaN ());
71
+ }
72
+ }
73
+ }
74
+
59
75
//JSON does not allow numbers to have f or d suffixes
60
76
public void testFloatMarker () throws Exception {
61
77
for (int mode : ALL_MODES ) {
You can’t perform that action at this time.
0 commit comments