Skip to content

Commit 31b3040

Browse files
committed
Merge branch '2.18' into 2.19
2 parents e4ac4f8 + e67a3ec commit 31b3040

26 files changed

+149
-54
lines changed

release-notes/VERSION-2.x

+6
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ a pure JSON library.
2323
#1361: `JsonPointer` parsing of '~' not followed by "0" or "1" unexpected
2424
(reported by @slz30)
2525

26+
2.18.3 (not yet released)
27+
28+
#1391: Fix issue where the parser can read back old number state when
29+
parsing later numbers
30+
(fix contributed by @pjfanning)
31+
2632
2.18.2 (27-Nov-2024)
2733

2834
#1359: Non-surrogate characters being incorrectly combined when

src/main/java/com/fasterxml/jackson/core/Base64Variants.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public final class Base64Variants
7676
* This non-standard variant is usually used when encoded data needs to be
7777
* passed via URLs (such as part of GET request). It differs from the
7878
* base {@link #MIME} variant in multiple ways.
79-
* First, no padding is used: this also means that it generally can not
79+
* First, no padding is used: this also means that it generally cannot
8080
* be written in multiple separate but adjacent chunks (which would not
8181
* be the usual use case in any case). Also, no linefeeds are used (max
8282
* line length set to infinite). And finally, two characters (plus and

src/main/java/com/fasterxml/jackson/core/FormatFeature.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
/**
66
* Marker interface that is to be implemented by data format - specific features.
7-
* Interface used since Java Enums can not extend classes or other Enums, but
7+
* Interface used since Java Enums cannot extend classes or other Enums, but
88
* they can implement interfaces; and as such we may be able to use limited
99
* amount of generic functionality.
1010
*<p>

src/main/java/com/fasterxml/jackson/core/JsonFactory.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -2308,7 +2308,7 @@ protected ContentReference _createContentReference(Object contentAccessor,
23082308
* for JSON handling. Problem here is that when adding new functionality
23092309
* via factory methods, it is not possible to leave these methods abstract
23102310
* (because we are implementing them for JSON); but there is risk that
2311-
* sub-classes do not override them all (plus older version can not implement).
2311+
* sub-classes do not override them all (plus older version cannot implement).
23122312
* So a work-around is to add a check to ensure that factory is still one
23132313
* used for JSON; and if not, make base implementation of a factory method fail.
23142314
*

src/main/java/com/fasterxml/jackson/core/JsonGenerator.java

+7-7
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,8 @@ public enum Feature {
177177
* One use case is to avoid problems with Javascript limitations:
178178
* since Javascript standard specifies that all number handling
179179
* should be done using 64-bit IEEE 754 floating point values,
180-
* result being that some 64-bit integer values can not be
181-
* accurately represent (as mantissa is only 51 bit wide).
180+
* result being that some 64-bit integer values cannot be
181+
* accurately represented (as mantissa is only 51 bit wide).
182182
*<p>
183183
* Feature is disabled by default.
184184
*
@@ -829,7 +829,7 @@ public int getOutputBuffered() {
829829
* Default implementation returns false; overridden by data formats
830830
* that do support native Object Ids. Caller is expected to either
831831
* use a non-native notation (explicit property or such), or fail,
832-
* in case it can not use native object ids.
832+
* in case it cannot use native object ids.
833833
*
834834
* @return {@code True} if this generator is capable of writing "native" Object Ids
835835
* (which is typically determined by capabilities of the underlying format),
@@ -849,7 +849,7 @@ public int getOutputBuffered() {
849849
* Default implementation returns false; overridden by data formats
850850
* that do support native Type Ids. Caller is expected to either
851851
* use a non-native notation (explicit property or such), or fail,
852-
* in case it can not use native type ids.
852+
* in case it cannot use native type ids.
853853
*
854854
* @return {@code True} if this generator is capable of writing "native" Type Ids
855855
* (which is typically determined by capabilities of the underlying format),
@@ -1300,7 +1300,7 @@ public void writeArray(String[] array, int offset, int length) throws IOExceptio
13001300
* Otherwise, write only len characters.
13011301
*<p>
13021302
* Note: actual length of content available may exceed {@code len} but
1303-
* can not be less than it: if not enough content available, a
1303+
* cannot be less than it: if not enough content available, a
13041304
* {@link JsonGenerationException} will be thrown.
13051305
*
13061306
* @param reader Reader to use for reading Text value to write
@@ -1556,7 +1556,7 @@ public void writeRawValue(SerializableString raw) throws IOException {
15561556
* encoded, as a complete String value (surrounded by double quotes).
15571557
* This method defaults
15581558
*<p>
1559-
* Note: because JSON Strings can not contain unescaped linefeeds,
1559+
* Note: because JSON Strings cannot contain unescaped linefeeds,
15601560
* if linefeeds are included (as per last argument), they must be
15611561
* escaped. This adds overhead for decoding without improving
15621562
* readability.
@@ -1770,7 +1770,7 @@ public abstract int writeBinary(Base64Variant bv,
17701770
* Write method that can be used for custom numeric types that can
17711771
* not be (easily?) converted to "standard" Java number types.
17721772
* Because numbers are not surrounded by double quotes, regular
1773-
* {@link #writeString} method can not be used; nor
1773+
* {@link #writeString} method cannot be used; nor
17741774
* {@link #writeRaw} because that does not properly handle
17751775
* value separators needed in Array or Object contexts.
17761776
*<p>

src/main/java/com/fasterxml/jackson/core/JsonParser.java

+19-19
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ public enum Feature {
366366
* Most common reason for disabling this feature is to avoid leaking information about
367367
* internal information; this may be done for security reasons.
368368
* Note that even if source reference is included, only parts of contents are usually
369-
* printed, and not the whole contents. Further, many source reference types can not
369+
* printed, and not the whole contents. Further, many source reference types cannot
370370
* necessarily access contents (like streams), so only type is indicated, not contents.
371371
*<p>
372372
* Since 2.16 feature is <b>disabled</b> by default (before 2.16 it was enabled),
@@ -888,12 +888,12 @@ public void setCurrentValue(Object v) {
888888
* done after reading all content of interest using parser.
889889
* Content is released by writing it to given stream if possible;
890890
* if underlying input is byte-based it can released, if not (char-based)
891-
* it can not.
891+
* it cannot.
892892
*
893893
* @param out OutputStream to which buffered, undecoded content is written to
894894
*
895895
* @return -1 if the underlying content source is not byte based
896-
* (that is, input can not be sent to {@link OutputStream};
896+
* (that is, input cannot be sent to {@link OutputStream};
897897
* otherwise number of bytes released (0 if there was nothing to release)
898898
*
899899
* @throws IOException if write to stream threw exception
@@ -909,12 +909,12 @@ public int releaseBuffered(OutputStream out) throws IOException {
909909
* done after reading all content of interest using parser.
910910
* Content is released by writing it to given writer if possible;
911911
* if underlying input is char-based it can released, if not (byte-based)
912-
* it can not.
912+
* it cannot.
913913
*
914914
* @param w Writer to which buffered but unprocessed content is written to
915915
*
916916
* @return -1 if the underlying content source is not char-based
917-
* (that is, input can not be sent to {@link Writer};
917+
* (that is, input cannot be sent to {@link Writer};
918918
* otherwise number of chars released (0 if there was nothing to release)
919919
*
920920
* @throws IOException if write using Writer threw exception
@@ -1926,7 +1926,7 @@ public short getShortValue() throws IOException
19261926
/**
19271927
* Numeric accessor that can be called when the current
19281928
* token is of type {@link JsonToken#VALUE_NUMBER_INT} and
1929-
* it can not be used as a Java long primitive type due to its
1929+
* it cannot be used as a Java long primitive type due to its
19301930
* magnitude.
19311931
* It can also be called for {@link JsonToken#VALUE_NUMBER_FLOAT};
19321932
* if so, it is equivalent to calling {@link #getDecimalValue}
@@ -2146,7 +2146,7 @@ public int readBinaryValue(Base64Variant bv, OutputStream out) throws IOExceptio
21462146
* and 1 (true), and Strings are parsed using default Java language integer
21472147
* parsing rules.
21482148
*<p>
2149-
* If representation can not be converted to an int (including structured type
2149+
* If representation cannot be converted to an int (including structured type
21502150
* markers like start/end Object/Array)
21512151
* default value of <b>0</b> will be returned; no exceptions are thrown.
21522152
*
@@ -2167,7 +2167,7 @@ public int getValueAsInt() throws IOException {
21672167
* and 1 (true), and Strings are parsed using default Java language integer
21682168
* parsing rules.
21692169
*<p>
2170-
* If representation can not be converted to an int (including structured type
2170+
* If representation cannot be converted to an int (including structured type
21712171
* markers like start/end Object/Array)
21722172
* specified <b>def</b> will be returned; no exceptions are thrown.
21732173
*
@@ -2187,7 +2187,7 @@ public int getValueAsInt() throws IOException {
21872187
* and 1 (true), and Strings are parsed using default Java language integer
21882188
* parsing rules.
21892189
*<p>
2190-
* If representation can not be converted to a long (including structured type
2190+
* If representation cannot be converted to a long (including structured type
21912191
* markers like start/end Object/Array)
21922192
* default value of <b>0L</b> will be returned; no exceptions are thrown.
21932193
*
@@ -2208,7 +2208,7 @@ public long getValueAsLong() throws IOException {
22082208
* and 1 (true), and Strings are parsed using default Java language integer
22092209
* parsing rules.
22102210
*<p>
2211-
* If representation can not be converted to a long (including structured type
2211+
* If representation cannot be converted to a long (including structured type
22122212
* markers like start/end Object/Array)
22132213
* specified <b>def</b> will be returned; no exceptions are thrown.
22142214
*
@@ -2230,7 +2230,7 @@ public long getValueAsLong(long def) throws IOException {
22302230
* and 1.0 (true), and Strings are parsed using default Java language floating
22312231
* point parsing rules.
22322232
*<p>
2233-
* If representation can not be converted to a double (including structured types
2233+
* If representation cannot be converted to a double (including structured types
22342234
* like Objects and Arrays),
22352235
* default value of <b>0.0</b> will be returned; no exceptions are thrown.
22362236
*
@@ -2251,7 +2251,7 @@ public double getValueAsDouble() throws IOException {
22512251
* and 1.0 (true), and Strings are parsed using default Java language floating
22522252
* point parsing rules.
22532253
*<p>
2254-
* If representation can not be converted to a double (including structured types
2254+
* If representation cannot be converted to a double (including structured types
22552255
* like Objects and Arrays),
22562256
* specified <b>def</b> will be returned; no exceptions are thrown.
22572257
*
@@ -2273,7 +2273,7 @@ public double getValueAsDouble(double def) throws IOException {
22732273
* 0 maps to false
22742274
* and Strings 'true' and 'false' map to corresponding values.
22752275
*<p>
2276-
* If representation can not be converted to a boolean value (including structured types
2276+
* If representation cannot be converted to a boolean value (including structured types
22772277
* like Objects and Arrays),
22782278
* default value of <b>false</b> will be returned; no exceptions are thrown.
22792279
*
@@ -2294,7 +2294,7 @@ public boolean getValueAsBoolean() throws IOException {
22942294
* 0 maps to false
22952295
* and Strings 'true' and 'false' map to corresponding values.
22962296
*<p>
2297-
* If representation can not be converted to a boolean value (including structured types
2297+
* If representation cannot be converted to a boolean value (including structured types
22982298
* like Objects and Arrays),
22992299
* specified <b>def</b> will be returned; no exceptions are thrown.
23002300
*
@@ -2314,7 +2314,7 @@ public boolean getValueAsBoolean(boolean def) throws IOException {
23142314
* {@link java.lang.String}.
23152315
* JSON Strings map naturally; scalar values get converted to
23162316
* their textual representation.
2317-
* If representation can not be converted to a String value (including structured types
2317+
* If representation cannot be converted to a String value (including structured types
23182318
* like Objects and Arrays and {@code null} token), default value of
23192319
* <b>null</b> will be returned; no exceptions are thrown.
23202320
*
@@ -2334,7 +2334,7 @@ public String getValueAsString() throws IOException {
23342334
* {@link java.lang.String}.
23352335
* JSON Strings map naturally; scalar values get converted to
23362336
* their textual representation.
2337-
* If representation can not be converted to a String value (including structured types
2337+
* If representation cannot be converted to a String value (including structured types
23382338
* like Objects and Arrays and {@code null} token), specified default value
23392339
* will be returned; no exceptions are thrown.
23402340
*
@@ -2363,7 +2363,7 @@ public String getValueAsString() throws IOException {
23632363
* Default implementation returns true; overridden by data formats
23642364
* that do support native Object Ids. Caller is expected to either
23652365
* use a non-native notation (explicit property or such), or fail,
2366-
* in case it can not use native object ids.
2366+
* in case it cannot use native object ids.
23672367
*
23682368
* @return {@code True} if the format being read supports native Object Ids;
23692369
* {@code false} if not
@@ -2380,7 +2380,7 @@ public String getValueAsString() throws IOException {
23802380
* Default implementation returns true; overridden by data formats
23812381
* that do support native Type Ids. Caller is expected to either
23822382
* use a non-native notation (explicit property or such), or fail,
2383-
* in case it can not use native type ids.
2383+
* in case it cannot use native type ids.
23842384
*
23852385
* @return {@code True} if the format being read supports native Type Ids;
23862386
* {@code false} if not
@@ -2454,7 +2454,7 @@ public String getValueAsString() throws IOException {
24542454
* Note: this method should NOT be used if the result type is a
24552455
* container ({@link java.util.Collection} or {@link java.util.Map}.
24562456
* The reason is that due to type erasure, key and value types
2457-
* can not be introspected when using this method.
2457+
* cannot be introspected when using this method.
24582458
*
24592459
* @param <T> Nominal type parameter for value type
24602460
*

src/main/java/com/fasterxml/jackson/core/JsonToken.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ public enum JsonToken
2121

2222
/**
2323
* NOT_AVAILABLE can be returned if {@link JsonParser}
24-
* implementation can not currently return the requested
24+
* implementation cannot currently return the requested
2525
* token (usually next one), or even if any will be
2626
* available, but that may be able to determine this in
2727
* future. This is the case with non-blocking parsers --
28-
* they can not block to wait for more data to parse and
28+
* they cannot block to wait for more data to parse and
2929
* must return something.
3030
*/
3131
NOT_AVAILABLE(null, JsonTokenId.ID_NOT_AVAILABLE),

src/main/java/com/fasterxml/jackson/core/ObjectCodec.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ protected ObjectCodec() { }
4444
* Note: this method should NOT be used if the result type is a
4545
* container ({@link java.util.Collection} or {@link java.util.Map}.
4646
* The reason is that due to type erasure, key and value types
47-
* can not be introspected when using this method.
47+
* cannot be introspected when using this method.
4848
*
4949
* @param <T> Nominal parameter for target type
5050
*

src/main/java/com/fasterxml/jackson/core/StreamReadFeature.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public enum StreamReadFeature
8282
* Most common reason for disabling this feature is to avoid leaking
8383
* internal information; this may be done for security reasons.
8484
* Note that even if source reference is included, only parts of contents are usually
85-
* printed, and not the whole contents. Further, many source reference types can not
85+
* printed, and not the whole contents. Further, many source reference types cannot
8686
* necessarily access contents (like streams), so only type is indicated, not contents.
8787
*<p>
8888
* Feature is enabled by default, meaning that "source reference" information is passed

src/main/java/com/fasterxml/jackson/core/TSFBuilder.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ public B configure(StreamWriteFeature f, boolean state) {
261261
/* 26-Jun-2018, tatu: This should not be needed here, but due to 2.x limitations,
262262
* we do need to include it or require casting.
263263
* Specifically: since `JsonFactory` (and not `TokenStreamFactory`) is base class
264-
* for all backends, it can not expose JSON-specific builder, but this.
264+
* for all backends, it cannot expose JSON-specific builder, but this.
265265
* So let's select lesser evil(s).
266266
*/
267267

src/main/java/com/fasterxml/jackson/core/TokenStreamFactory.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ protected OutputStream _createDataOutputWrapper(DataOutput out) {
282282
*/
283283
protected InputStream _optimizedStreamFromURL(URL url) throws IOException {
284284
if ("file".equals(url.getProtocol())) {
285-
/* Can not do this if the path refers
285+
/* Cannot do this if the path refers
286286
* to a network drive on windows. This fixes the problem;
287287
* might not be needed on all platforms (NFS?), but should not
288288
* matter a lot: performance penalty of extra wrapping is more

src/main/java/com/fasterxml/jackson/core/base/ParserBase.java

+4
Original file line numberDiff line numberDiff line change
@@ -813,6 +813,7 @@ public BigInteger getBigIntegerValue() throws IOException
813813
}
814814
if ((_numTypesValid & NR_BIGINT) == 0) {
815815
convertNumberToBigInteger();
816+
return _numberBigInt;
816817
}
817818
}
818819
return _getBigInteger();
@@ -835,6 +836,7 @@ public float getFloatValue() throws IOException
835836
}
836837
if ((_numTypesValid & NR_FLOAT) == 0) {
837838
convertNumberToFloat();
839+
return _numberFloat;
838840
}
839841
}
840842
return _getNumberFloat();
@@ -850,6 +852,7 @@ public double getDoubleValue() throws IOException
850852
// if underlying type not FP, need conversion:
851853
if ((_numTypesValid & NR_DOUBLE) == 0) {
852854
convertNumberToDouble();
855+
return _numberDouble;
853856
}
854857
}
855858
return _getNumberDouble();
@@ -864,6 +867,7 @@ public BigDecimal getDecimalValue() throws IOException
864867
}
865868
if ((_numTypesValid & NR_BIGDECIMAL) == 0) {
866869
convertNumberToBigDecimal();
870+
return _numberBigDecimal;
867871
}
868872
}
869873
return _getBigDecimal();

src/main/java/com/fasterxml/jackson/core/format/InputAccessor.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public boolean hasMoreBytes() throws IOException
103103
return false;
104104
}
105105
int amount = _buffer.length - _ptr;
106-
if (amount < 1) { // can not load any more
106+
if (amount < 1) { // cannot load any more
107107
return false;
108108
}
109109
int count = _in.read(_buffer, _ptr, amount);

src/main/java/com/fasterxml/jackson/core/format/MatchStrength.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,23 @@
1010
public enum MatchStrength
1111
{
1212
/**
13-
* Value that indicates that given data can not be in given format.
13+
* Value that indicates that given data cannot be in given format.
1414
*/
1515
NO_MATCH,
1616

1717
/**
18-
* Value that indicates that detector can not find out whether could
18+
* Value that indicates that detector cannot find out whether could
1919
* be a match or not.
2020
* This can occur for example for textual data formats t
21-
* when there are so many leading spaces that detector can not
21+
* when there are so many leading spaces that detector cannot
2222
* find the first data byte (because detectors typically limit lookahead
2323
* to some smallish value).
2424
*/
2525
INCONCLUSIVE,
2626

2727
/**
2828
* Value that indicates that given data could be of specified format (i.e.
29-
* it can not be ruled out). This can occur for example when seen data
29+
* it cannot be ruled out). This can occur for example when seen data
3030
* is both not in canonical formats (for example: JSON data should be a JSON Array or Object
3131
* not a scalar value, as per JSON specification) and there are known use case
3232
* where a format detected is actually used (plain JSON Strings are actually used, even

0 commit comments

Comments
 (0)