File tree Expand file tree Collapse file tree 3 files changed +18
-6
lines changed
main/java/com/fasterxml/jackson/core
test/java/com/fasterxml/jackson/core/read Expand file tree Collapse file tree 3 files changed +18
-6
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,12 @@ a pure JSON library.
47
47
(requested by Ilenia S )
48
48
(fixed by @pjfanning )
49
49
50
+ 2.18 .5 (not yet released )
51
+
52
+ #1433 : `JsonParser#getNumberType()` throws `JsonParseException` when
53
+ the current token is non - numeric instead of returning null
54
+ (reported by @CrazySqueak )
55
+
50
56
2.18 .4 (06 - May - 2025 )
51
57
52
58
No changes since 2.18 .3
Original file line number Diff line number Diff line change @@ -1778,12 +1778,18 @@ public Object getNumberValueDeferred() throws IOException {
1778
1778
* If current token is of type
1779
1779
* {@link JsonToken#VALUE_NUMBER_INT} or
1780
1780
* {@link JsonToken#VALUE_NUMBER_FLOAT}, returns
1781
- * one of {@link NumberType} constants; otherwise returns {@code null}.
1781
+ * one of {@link NumberType} constants; otherwise throws
1782
+ * a {@link JsonParseException}.
1783
+ *<p>
1784
+ * NOTE: before 2.18 was documented to return {@code null} for non-numeric
1785
+ * tokens, but this has never been the case.
1782
1786
*
1783
- * @return Type of current number, if parser points to numeric token; {@code null} otherwise
1787
+ * @return Type of current number, if parser points to numeric token.
1784
1788
*
1785
- * @throws IOException for low-level read issues, or
1786
- * {@link JsonParseException} for decoding problems
1789
+ * @throws IOException {@link JsonParseException} if
1790
+ * the current token is not numeric, or if decoding of the value fails
1791
+ * (invalid format for numbers); plain {@link IOException} if underlying
1792
+ * content read fails (possible if numbers are decoded lazily).
1787
1793
*/
1788
1794
public abstract NumberType getNumberType () throws IOException ;
1789
1795
Original file line number Diff line number Diff line change 22
22
*/
23
23
@ SuppressWarnings ("resource" )
24
24
class NumberParsingTest
25
- extends JUnit5TestBase
25
+ extends JUnit5TestBase
26
26
{
27
27
protected JsonFactory jsonFactory () {
28
28
return sharedStreamFactory ();
@@ -33,7 +33,7 @@ protected JsonFactory jsonFactory() {
33
33
34
34
/*
35
35
/**********************************************************************
36
- /* Tests, Boolean
36
+ /* Tests, Boolean (why here?)
37
37
/**********************************************************************
38
38
*/
39
39
You can’t perform that action at this time.
0 commit comments