`Stax2ReaderAdapter.nextTag()` skips the adapter's own state handling
評価
調査の方向性
Start with Stax2ReaderAdapter, which inherits nextTag() from StreamReaderDelegate and so bypasses the adapter's own next(), where depth and pending chunked-read handling live. Compare the two methods, then run Stax2ReaderAdapterTest and ReadElementAsArrayTest. Done when getDepth() matches between next() and nextTag(), and the repro reads [6, 7, 8] for <b> instead of [3, 4, 5].
索引モデルが issue の本文から書いたものです。
説明
Found this bug along the way. Please have look. I'll provide PR with tests.
Stax2ReaderAdapter does not override nextTag(), so the nextTag() it inherits from StreamReaderDelegate calls the wrapped reader's nextTag() directly and bypasses the adapter's next(). Two effects:
- Depth:
getDepth()is not updated bynextTag(), so it is wrong for any code that walks elements withnextTag(). - Chunked array reads: if an element was only partly read with
readElementAsIntArray()etc.,nextTag()doesn't discard the unread rest. Array reads of the next element then return the previous element's leftovers.
Repro: <root><a>1 2 3 4 5</a> <b>6 7 8</b></root>. Read 2 values of <a>, then nextTag() twice to reach <b>, then read <b> as an int array → [3, 4, 5] (expected: [6, 7, 8]).
Fix: override nextTag() like next(): end a pending chunked read by returning END_ELEMENT, and otherwise update the depth for the start or end element returned. Tests: Stax2ReaderAdapterTest (depths with next() vs nextTag(), and after leaving a chunked read early) and ReadElementAsArrayTest.leavesNothingForNextElementWhenAbandonedViaNextTag.
- 主要言語
- Java
- スター
- 42
- フォーク
- 21
- 平均マージ
- 3時間 50分
- マージ済み PR(30日)
- 2
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
FasterXML/stax2-api のほかの issue
-
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
-
`DOMWrappingReader.getDepth()` is one too low at `START_ELEMENT`, and typed array reads lose a levelオープン
難易度 3/5 1〜2日 初心者へのやさしさ 58/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 35/100
FasterXML/stax2-api の issue をすべて見る
似ている issue
-
Cleanup: restore the interrupt flag in AiFailureAnalyzer対応中かも @Rishankgupta08 が今日担当しました。 オープンgood first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
seleniumboot/selenium-boot#258 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
dense-analysis/ale#5181 ·
-
bug subsystem:agent-harness triage
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
ShaftHQ/SHAFT_ENGINE#8043 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
johanhaleby/occurrent#1505 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信