File tree Expand file tree Collapse file tree 4 files changed +26
-5
lines changed
main/java/com/fasterxml/jackson/dataformat/cbor
test/java/com/fasterxml/jackson/dataformat/cbor Expand file tree Collapse file tree 4 files changed +26
-5
lines changed Original file line number Diff line number Diff 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 ) {
Original file line number Diff line number Diff line change 1- package com .fasterxml .jackson .dataformat .cbor . tofix ;
1+ package com .fasterxml .jackson .dataformat .cbor ;
22
33import java .util .Arrays ;
44
55import com .fasterxml .jackson .core .JsonToken ;
66import com .fasterxml .jackson .databind .ObjectMapper ;
77
8- import com .fasterxml .jackson .dataformat .cbor .*;
9- import com .fasterxml .jackson .dataformat .cbor .testutil .failure .JacksonTestFailureExpected ;
10-
118import static org .junit .jupiter .api .Assertions .assertEquals ;
129
1310import org .junit .jupiter .api .Test ;
@@ -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 {
Original file line number Diff line number Diff line change @@ -422,3 +422,7 @@ Vincent Eigenberger (@beseder1)
422422 * Contributed fix for #601 : Jackson subtype Avro schema unions are non-deterministic
423423 and therefore incompatible with each other
424424 (2.20 .1 )
425+
426+ Yohei Kishimoto (@morokosi )
427+ * Reported #599 : (cbor) Unable to deserialize stringref-enabled CBOR with ignored properties
428+ (2.21 .0 )
Original file line number Diff line number Diff line change @@ -16,6 +16,8 @@ Active maintainers:
1616
17172.21 .0 (not yet released )
1818
19+ #599 : (cbor ) Unable to deserialize stringref - enabled CBOR with ignored properties
20+ (reported by Yohei K )
1921#623 : (ion) Upgrade `ion-java` dep to 1.11.11 (from 1.11.10)
2022 (requested by @Shaurya0108 )
2123
You can’t perform that action at this time.
0 commit comments