Skip to content

Commit

Permalink
Merge branch '2.18' into 2.19
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Jan 27, 2025
2 parents e4ac4f8 + e67a3ec commit 31b3040
Show file tree
Hide file tree
Showing 26 changed files with 149 additions and 54 deletions.
6 changes: 6 additions & 0 deletions release-notes/VERSION-2.x
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ a pure JSON library.
#1361: `JsonPointer` parsing of '~' not followed by "0" or "1" unexpected
(reported by @slz30)

2.18.3 (not yet released)

#1391: Fix issue where the parser can read back old number state when
parsing later numbers
(fix contributed by @pjfanning)

2.18.2 (27-Nov-2024)

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

/**
* Marker interface that is to be implemented by data format - specific features.
* Interface used since Java Enums can not extend classes or other Enums, but
* Interface used since Java Enums cannot extend classes or other Enums, but
* they can implement interfaces; and as such we may be able to use limited
* amount of generic functionality.
*<p>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/fasterxml/jackson/core/JsonFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -2308,7 +2308,7 @@ protected ContentReference _createContentReference(Object contentAccessor,
* for JSON handling. Problem here is that when adding new functionality
* via factory methods, it is not possible to leave these methods abstract
* (because we are implementing them for JSON); but there is risk that
* sub-classes do not override them all (plus older version can not implement).
* sub-classes do not override them all (plus older version cannot implement).
* So a work-around is to add a check to ensure that factory is still one
* used for JSON; and if not, make base implementation of a factory method fail.
*
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/com/fasterxml/jackson/core/JsonGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,8 @@ public enum Feature {
* One use case is to avoid problems with Javascript limitations:
* since Javascript standard specifies that all number handling
* should be done using 64-bit IEEE 754 floating point values,
* result being that some 64-bit integer values can not be
* accurately represent (as mantissa is only 51 bit wide).
* result being that some 64-bit integer values cannot be
* accurately represented (as mantissa is only 51 bit wide).
*<p>
* Feature is disabled by default.
*
Expand Down Expand Up @@ -829,7 +829,7 @@ public int getOutputBuffered() {
* Default implementation returns false; overridden by data formats
* that do support native Object Ids. Caller is expected to either
* use a non-native notation (explicit property or such), or fail,
* in case it can not use native object ids.
* in case it cannot use native object ids.
*
* @return {@code True} if this generator is capable of writing "native" Object Ids
* (which is typically determined by capabilities of the underlying format),
Expand All @@ -849,7 +849,7 @@ public int getOutputBuffered() {
* Default implementation returns false; overridden by data formats
* that do support native Type Ids. Caller is expected to either
* use a non-native notation (explicit property or such), or fail,
* in case it can not use native type ids.
* in case it cannot use native type ids.
*
* @return {@code True} if this generator is capable of writing "native" Type Ids
* (which is typically determined by capabilities of the underlying format),
Expand Down Expand Up @@ -1300,7 +1300,7 @@ public void writeArray(String[] array, int offset, int length) throws IOExceptio
* Otherwise, write only len characters.
*<p>
* Note: actual length of content available may exceed {@code len} but
* can not be less than it: if not enough content available, a
* cannot be less than it: if not enough content available, a
* {@link JsonGenerationException} will be thrown.
*
* @param reader Reader to use for reading Text value to write
Expand Down Expand Up @@ -1556,7 +1556,7 @@ public void writeRawValue(SerializableString raw) throws IOException {
* encoded, as a complete String value (surrounded by double quotes).
* This method defaults
*<p>
* Note: because JSON Strings can not contain unescaped linefeeds,
* Note: because JSON Strings cannot contain unescaped linefeeds,
* if linefeeds are included (as per last argument), they must be
* escaped. This adds overhead for decoding without improving
* readability.
Expand Down Expand Up @@ -1770,7 +1770,7 @@ public abstract int writeBinary(Base64Variant bv,
* Write method that can be used for custom numeric types that can
* not be (easily?) converted to "standard" Java number types.
* Because numbers are not surrounded by double quotes, regular
* {@link #writeString} method can not be used; nor
* {@link #writeString} method cannot be used; nor
* {@link #writeRaw} because that does not properly handle
* value separators needed in Array or Object contexts.
*<p>
Expand Down
38 changes: 19 additions & 19 deletions src/main/java/com/fasterxml/jackson/core/JsonParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ public enum Feature {
* Most common reason for disabling this feature is to avoid leaking information about
* internal information; this may be done for security reasons.
* Note that even if source reference is included, only parts of contents are usually
* printed, and not the whole contents. Further, many source reference types can not
* printed, and not the whole contents. Further, many source reference types cannot
* necessarily access contents (like streams), so only type is indicated, not contents.
*<p>
* Since 2.16 feature is <b>disabled</b> by default (before 2.16 it was enabled),
Expand Down Expand Up @@ -888,12 +888,12 @@ public void setCurrentValue(Object v) {
* done after reading all content of interest using parser.
* Content is released by writing it to given stream if possible;
* if underlying input is byte-based it can released, if not (char-based)
* it can not.
* it cannot.
*
* @param out OutputStream to which buffered, undecoded content is written to
*
* @return -1 if the underlying content source is not byte based
* (that is, input can not be sent to {@link OutputStream};
* (that is, input cannot be sent to {@link OutputStream};
* otherwise number of bytes released (0 if there was nothing to release)
*
* @throws IOException if write to stream threw exception
Expand All @@ -909,12 +909,12 @@ public int releaseBuffered(OutputStream out) throws IOException {
* done after reading all content of interest using parser.
* Content is released by writing it to given writer if possible;
* if underlying input is char-based it can released, if not (byte-based)
* it can not.
* it cannot.
*
* @param w Writer to which buffered but unprocessed content is written to
*
* @return -1 if the underlying content source is not char-based
* (that is, input can not be sent to {@link Writer};
* (that is, input cannot be sent to {@link Writer};
* otherwise number of chars released (0 if there was nothing to release)
*
* @throws IOException if write using Writer threw exception
Expand Down Expand Up @@ -1926,7 +1926,7 @@ public short getShortValue() throws IOException
/**
* Numeric accessor that can be called when the current
* token is of type {@link JsonToken#VALUE_NUMBER_INT} and
* it can not be used as a Java long primitive type due to its
* it cannot be used as a Java long primitive type due to its
* magnitude.
* It can also be called for {@link JsonToken#VALUE_NUMBER_FLOAT};
* if so, it is equivalent to calling {@link #getDecimalValue}
Expand Down Expand Up @@ -2146,7 +2146,7 @@ public int readBinaryValue(Base64Variant bv, OutputStream out) throws IOExceptio
* and 1 (true), and Strings are parsed using default Java language integer
* parsing rules.
*<p>
* If representation can not be converted to an int (including structured type
* If representation cannot be converted to an int (including structured type
* markers like start/end Object/Array)
* default value of <b>0</b> will be returned; no exceptions are thrown.
*
Expand All @@ -2167,7 +2167,7 @@ public int getValueAsInt() throws IOException {
* and 1 (true), and Strings are parsed using default Java language integer
* parsing rules.
*<p>
* If representation can not be converted to an int (including structured type
* If representation cannot be converted to an int (including structured type
* markers like start/end Object/Array)
* specified <b>def</b> will be returned; no exceptions are thrown.
*
Expand All @@ -2187,7 +2187,7 @@ public int getValueAsInt() throws IOException {
* and 1 (true), and Strings are parsed using default Java language integer
* parsing rules.
*<p>
* If representation can not be converted to a long (including structured type
* If representation cannot be converted to a long (including structured type
* markers like start/end Object/Array)
* default value of <b>0L</b> will be returned; no exceptions are thrown.
*
Expand All @@ -2208,7 +2208,7 @@ public long getValueAsLong() throws IOException {
* and 1 (true), and Strings are parsed using default Java language integer
* parsing rules.
*<p>
* If representation can not be converted to a long (including structured type
* If representation cannot be converted to a long (including structured type
* markers like start/end Object/Array)
* specified <b>def</b> will be returned; no exceptions are thrown.
*
Expand All @@ -2230,7 +2230,7 @@ public long getValueAsLong(long def) throws IOException {
* and 1.0 (true), and Strings are parsed using default Java language floating
* point parsing rules.
*<p>
* If representation can not be converted to a double (including structured types
* If representation cannot be converted to a double (including structured types
* like Objects and Arrays),
* default value of <b>0.0</b> will be returned; no exceptions are thrown.
*
Expand All @@ -2251,7 +2251,7 @@ public double getValueAsDouble() throws IOException {
* and 1.0 (true), and Strings are parsed using default Java language floating
* point parsing rules.
*<p>
* If representation can not be converted to a double (including structured types
* If representation cannot be converted to a double (including structured types
* like Objects and Arrays),
* specified <b>def</b> will be returned; no exceptions are thrown.
*
Expand All @@ -2273,7 +2273,7 @@ public double getValueAsDouble(double def) throws IOException {
* 0 maps to false
* and Strings 'true' and 'false' map to corresponding values.
*<p>
* If representation can not be converted to a boolean value (including structured types
* If representation cannot be converted to a boolean value (including structured types
* like Objects and Arrays),
* default value of <b>false</b> will be returned; no exceptions are thrown.
*
Expand All @@ -2294,7 +2294,7 @@ public boolean getValueAsBoolean() throws IOException {
* 0 maps to false
* and Strings 'true' and 'false' map to corresponding values.
*<p>
* If representation can not be converted to a boolean value (including structured types
* If representation cannot be converted to a boolean value (including structured types
* like Objects and Arrays),
* specified <b>def</b> will be returned; no exceptions are thrown.
*
Expand All @@ -2314,7 +2314,7 @@ public boolean getValueAsBoolean(boolean def) throws IOException {
* {@link java.lang.String}.
* JSON Strings map naturally; scalar values get converted to
* their textual representation.
* If representation can not be converted to a String value (including structured types
* If representation cannot be converted to a String value (including structured types
* like Objects and Arrays and {@code null} token), default value of
* <b>null</b> will be returned; no exceptions are thrown.
*
Expand All @@ -2334,7 +2334,7 @@ public String getValueAsString() throws IOException {
* {@link java.lang.String}.
* JSON Strings map naturally; scalar values get converted to
* their textual representation.
* If representation can not be converted to a String value (including structured types
* If representation cannot be converted to a String value (including structured types
* like Objects and Arrays and {@code null} token), specified default value
* will be returned; no exceptions are thrown.
*
Expand Down Expand Up @@ -2363,7 +2363,7 @@ public String getValueAsString() throws IOException {
* Default implementation returns true; overridden by data formats
* that do support native Object Ids. Caller is expected to either
* use a non-native notation (explicit property or such), or fail,
* in case it can not use native object ids.
* in case it cannot use native object ids.
*
* @return {@code True} if the format being read supports native Object Ids;
* {@code false} if not
Expand All @@ -2380,7 +2380,7 @@ public String getValueAsString() throws IOException {
* Default implementation returns true; overridden by data formats
* that do support native Type Ids. Caller is expected to either
* use a non-native notation (explicit property or such), or fail,
* in case it can not use native type ids.
* in case it cannot use native type ids.
*
* @return {@code True} if the format being read supports native Type Ids;
* {@code false} if not
Expand Down Expand Up @@ -2454,7 +2454,7 @@ public String getValueAsString() throws IOException {
* Note: this method should NOT be used if the result type is a
* container ({@link java.util.Collection} or {@link java.util.Map}.
* The reason is that due to type erasure, key and value types
* can not be introspected when using this method.
* cannot be introspected when using this method.
*
* @param <T> Nominal type parameter for value type
*
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/fasterxml/jackson/core/JsonToken.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ public enum JsonToken

/**
* NOT_AVAILABLE can be returned if {@link JsonParser}
* implementation can not currently return the requested
* implementation cannot currently return the requested
* token (usually next one), or even if any will be
* available, but that may be able to determine this in
* future. This is the case with non-blocking parsers --
* they can not block to wait for more data to parse and
* they cannot block to wait for more data to parse and
* must return something.
*/
NOT_AVAILABLE(null, JsonTokenId.ID_NOT_AVAILABLE),
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/fasterxml/jackson/core/ObjectCodec.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ protected ObjectCodec() { }
* Note: this method should NOT be used if the result type is a
* container ({@link java.util.Collection} or {@link java.util.Map}.
* The reason is that due to type erasure, key and value types
* can not be introspected when using this method.
* cannot be introspected when using this method.
*
* @param <T> Nominal parameter for target type
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public enum StreamReadFeature
* Most common reason for disabling this feature is to avoid leaking
* internal information; this may be done for security reasons.
* Note that even if source reference is included, only parts of contents are usually
* printed, and not the whole contents. Further, many source reference types can not
* printed, and not the whole contents. Further, many source reference types cannot
* necessarily access contents (like streams), so only type is indicated, not contents.
*<p>
* Feature is enabled by default, meaning that "source reference" information is passed
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/fasterxml/jackson/core/TSFBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ public B configure(StreamWriteFeature f, boolean state) {
/* 26-Jun-2018, tatu: This should not be needed here, but due to 2.x limitations,
* we do need to include it or require casting.
* Specifically: since `JsonFactory` (and not `TokenStreamFactory`) is base class
* for all backends, it can not expose JSON-specific builder, but this.
* for all backends, it cannot expose JSON-specific builder, but this.
* So let's select lesser evil(s).
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ protected OutputStream _createDataOutputWrapper(DataOutput out) {
*/
protected InputStream _optimizedStreamFromURL(URL url) throws IOException {
if ("file".equals(url.getProtocol())) {
/* Can not do this if the path refers
/* Cannot do this if the path refers
* to a network drive on windows. This fixes the problem;
* might not be needed on all platforms (NFS?), but should not
* matter a lot: performance penalty of extra wrapping is more
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/com/fasterxml/jackson/core/base/ParserBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -813,6 +813,7 @@ public BigInteger getBigIntegerValue() throws IOException
}
if ((_numTypesValid & NR_BIGINT) == 0) {
convertNumberToBigInteger();
return _numberBigInt;
}
}
return _getBigInteger();
Expand All @@ -835,6 +836,7 @@ public float getFloatValue() throws IOException
}
if ((_numTypesValid & NR_FLOAT) == 0) {
convertNumberToFloat();
return _numberFloat;
}
}
return _getNumberFloat();
Expand All @@ -850,6 +852,7 @@ public double getDoubleValue() throws IOException
// if underlying type not FP, need conversion:
if ((_numTypesValid & NR_DOUBLE) == 0) {
convertNumberToDouble();
return _numberDouble;
}
}
return _getNumberDouble();
Expand All @@ -864,6 +867,7 @@ public BigDecimal getDecimalValue() throws IOException
}
if ((_numTypesValid & NR_BIGDECIMAL) == 0) {
convertNumberToBigDecimal();
return _numberBigDecimal;
}
}
return _getBigDecimal();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public boolean hasMoreBytes() throws IOException
return false;
}
int amount = _buffer.length - _ptr;
if (amount < 1) { // can not load any more
if (amount < 1) { // cannot load any more
return false;
}
int count = _in.read(_buffer, _ptr, amount);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,23 @@
public enum MatchStrength
{
/**
* Value that indicates that given data can not be in given format.
* Value that indicates that given data cannot be in given format.
*/
NO_MATCH,

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

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

0 comments on commit 31b3040

Please sign in to comment.