Skip to content

Commit d783c96

Browse files
committed
Merge branch '2.19' into 2.20
2 parents 332c05e + bc3429b commit d783c96

File tree

3 files changed

+24
-7
lines changed

3 files changed

+24
-7
lines changed

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

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3414,6 +3414,25 @@ protected void _skipIncomplete() throws IOException
34143414
&& type != CBORConstants.MAJOR_TYPE_BYTES) {
34153415
_throwInternal();
34163416
}
3417+
3418+
// [dataformats-binary#599]: If we are in a stringref namespace, we need to
3419+
// actually read and store the string/bytes value instead of just skipping it,
3420+
// so that later string references can find it.
3421+
// The finish methods will determine if the value should be added to the
3422+
// reference table based on shouldReferenceString().
3423+
if (!_stringRefs.empty()) {
3424+
if (type == CBORConstants.MAJOR_TYPE_TEXT) {
3425+
// Need to actually read the text (which may add to stringRefs)
3426+
_finishTextToken(_typeByte);
3427+
} else {
3428+
// For bytes: decode length then read (which may add to stringRefs)
3429+
int len = _decodeExplicitLength(_typeByte & 0x1F);
3430+
_finishBytes(len);
3431+
}
3432+
return;
3433+
}
3434+
3435+
// Standard skip logic when not in stringref namespace
34173436
final int lowBits = _typeByte & 0x1F;
34183437
if (lowBits <= 23) {
34193438
if (lowBits > 0) {
Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
1-
package com.fasterxml.jackson.dataformat.cbor.tofix;
1+
package com.fasterxml.jackson.dataformat.cbor;
22

33
import java.util.Arrays;
44

5+
import org.junit.jupiter.api.Test;
6+
57
import com.fasterxml.jackson.core.JsonToken;
68
import com.fasterxml.jackson.databind.ObjectMapper;
79

8-
import com.fasterxml.jackson.dataformat.cbor.*;
9-
import com.fasterxml.jackson.dataformat.cbor.testutil.failure.JacksonTestFailureExpected;
10-
1110
import static org.junit.jupiter.api.Assertions.assertEquals;
1211

13-
import org.junit.jupiter.api.Test;
14-
1512
public class StringRef599Test extends CBORTestBase
1613
{
1714
private final ObjectMapper VANILLA_MAPPER = cborMapper();
@@ -27,7 +24,6 @@ public void testDupsNoStringRef() throws Exception
2724
}
2825

2926
// [dataformats-binary#599]
30-
@JacksonTestFailureExpected
3127
@Test
3228
public void testDupsWithStringRef() throws Exception
3329
{

release-notes/VERSION-2.x

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ No changes since 2.19.1
9090

9191
2.18.5 (not yet released)
9292

93+
#599: (cbor) Unable to deserialize stringref-enabled CBOR with ignored properties
94+
(reported by Yohei K)
9395
#623: (ion) Upgrade `ion-java` dep to 1.11.11 (from 1.11.10)
9496
(requested by @Shaurya0108)
9597

0 commit comments

Comments
 (0)