File tree Expand file tree Collapse file tree
cbor/src/main/java/tools/jackson/dataformat/cbor Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77import java .math .BigInteger ;
88import java .nio .charset .Charset ;
99import java .nio .charset .StandardCharsets ;
10+ import java .util .ArrayDeque ;
1011import java .util .ArrayList ;
1112import java .util .Arrays ;
12- import java .util .Stack ;
1313
1414import tools .jackson .core .*;
1515import tools .jackson .core .base .ParserBase ;
@@ -206,7 +206,7 @@ public void push(boolean hasNamespace) {
206206
207207 public void pop () {
208208 --_nestedDepth ;
209- if (!_stringRefs .empty () && _stringRefs .peek ().depth == _nestedDepth ) {
209+ if (!_stringRefs .isEmpty () && _stringRefs .peek ().depth == _nestedDepth ) {
210210 _stringRefs .pop ();
211211 }
212212 }
@@ -216,10 +216,12 @@ public StringRefList peek() {
216216 }
217217
218218 public boolean empty () {
219- return _stringRefs .empty ();
219+ return _stringRefs .isEmpty ();
220220 }
221221
222- private Stack <StringRefList > _stringRefs = new Stack <>();
222+ // 28-Jul-2026, tatu: [dataformats-binary#742] Use non-synchronized
223+ // `ArrayDeque` instead of (synchronized) `Stack`
224+ private final ArrayDeque <StringRefList > _stringRefs = new ArrayDeque <>();
223225 private int _nestedDepth = 0 ;
224226 }
225227
Original file line number Diff line number Diff line change @@ -50,3 +50,8 @@ Juan Farré (@jafarre-bi)
5050* Reported #700: (cbor, smile) `META-INF/services/tools.jackson.databind.ObjectMapper`
5151 references wrong class name (`...databind.CBORMapper` / `...databind.SmileMapper`)
5252 (3.1.5)
53+
54+ Benoît Mériaux (@benoitmeriaux)
55+
56+ * Reported #742: Use `ArrayDeque` instead of `Stack` in `CBORParser`
57+ (3.1.6)
Original file line number Diff line number Diff line change @@ -39,6 +39,9 @@ No changes since 3.2
3939#735: (cbor) "stringref" property-name paths pass 5-bit length marker instead of
4040 actual length to `shouldReferenceString()`
4141#736: (cbor) Long Object property names added to "stringref" reference table twice
42+ #742: Use `ArrayDeque` instead of `Stack` in `CBORParser`
43+ (reported by Benoît M)
44+ (fix by @cowtowncoder, w/ Claude code)
4245
43463.2.1 (10-Jul-2026)
4447
@@ -73,6 +76,9 @@ No changes since 3.2.0
7376 actual length to `shouldReferenceString()`
7477#736: (cbor) Long Object property names added to "stringref" reference table twice
7578 (NOTE: in 3.x this affected the `nextNameMatch()` decoding path as well)
79+ #742: Use `ArrayDeque` instead of `Stack` in `CBORParser`
80+ (reported by Benoît M)
81+ (fix by @cowtowncoder, w/ Claude code)
7682
77833.1.5 (07-Jul-2026)
7884
You can’t perform that action at this time.
0 commit comments