Skip to content

Commit cae0ab7

Browse files
committed
Fix minor bug I introduced :)
1 parent bdf400e commit cae0ab7

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

cbor/src/main/java/com/fasterxml/jackson/dataformat/cbor/CBORConstants.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,11 @@ public final class CBORConstants
113113

114114
public final static int INT_BREAK = 0xFF;
115115

116+
/**
117+
* Marker for "undefined" value in CBOR spec.
118+
*
119+
* @since 2.20
120+
*/
116121
public final static int SIMPLE_VALUE_UNDEFINED = 0xF7;
117122

118123
/*

cbor/src/main/java/com/fasterxml/jackson/dataformat/cbor/CBORParser.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,13 @@ public enum Feature implements FormatFeature
4949

5050
/**
5151
* Feature that determines how an ` undefined ` value (0xF7) is decoded.
52-
*
5352
* <p>
5453
* When enabled, the parser returns {@link JsonToken#VALUE_EMBEDDED_OBJECT} with a
5554
* value of {@code null}, allowing the caller to distinguish `undefined` from actual
5655
* {@link JsonToken#VALUE_NULL}.
5756
*<p>
5857
* When disabled (default, for backwards compatibility), `undefined` value is
59-
* reported as {@link JsonToken#VALUE_NULL}, maintaining legacy behavior from Jackson 2.9.6 to 2.19.
60-
*<p>
58+
* reported as {@link JsonToken#VALUE_NULL}, maintaining legacy behavior from Jackson 2.10 to 2.19.
6159
*
6260
* @since 2.20
6361
*/
@@ -1943,7 +1941,7 @@ private final byte[] _getBinaryFromString(Base64Variant variant) throws IOExcept
19431941
* @since 2.20
19441942
*/
19451943
public boolean isUndefined() {
1946-
if ((_currToken == JsonToken.VALUE_NULL) || (_currToken == JsonToken.VALUE_NULL)) {
1944+
if ((_currToken == JsonToken.VALUE_NULL) || (_currToken == JsonToken.VALUE_EMBEDDED_OBJECT)) {
19471945
return (_inputBuffer != null)
19481946
&& (_inputBuffer[_inputPtr - 1] & 0xFF) == SIMPLE_VALUE_UNDEFINED;
19491947
}

cbor/src/test/java/com/fasterxml/jackson/dataformat/cbor/parse/UndefinedValueTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
// for [dataformat-binary#93]
1515
public class UndefinedValueTest extends CBORTestBase
1616
{
17-
private final static byte BYTE_UNDEFINED = (byte) 0xF7;
17+
private final static byte BYTE_UNDEFINED = (byte) CBORConstants.SIMPLE_VALUE_UNDEFINED;
1818

1919
private final CBORFactory CBOR_F = cborFactory();
2020

0 commit comments

Comments
 (0)