Skip to content

Commit 596fd82

Browse files
authored
Fixing non-blocking parser reporting incorrect location when fed with non-zero offset (#1415)
1 parent 99f749d commit 596fd82

File tree

5 files changed

+15
-4
lines changed

5 files changed

+15
-4
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
strategy:
2626
fail-fast: false
2727
matrix:
28-
java_version: ['8', '11', '17', '21', '23']
28+
java_version: ['8', '17', '21', '23']
2929
# We will actually need "os" as Matrix to have Windows build
3030
os: ['ubuntu-22.04']
3131
include:

release-notes/CREDITS-2.x

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,9 @@ David Nault (dnault@github)
214214
* Reported #531: Non-blocking parser reports incorrect locations when fed with
215215
non-zero offset
216216
(2.10.0)
217+
* Reported 1412: More cases of Non-blocking parser reporting incorrect locations
218+
when fed with non-zero offset
219+
(2.19.0)
217220
218221
Fabien Renaud (fabienrenaud@github)
219222
* Reported, contributed fix for #533: UTF-8 BOM not accounted for in
@@ -471,3 +474,8 @@ Eduard Gomoliako (@Gems)
471474
* Contributed #1356: Make `JsonGenerator::writeTypePrefix` method to not write a
472475
`WRAPPER_ARRAY` when `typeIdDef.id == null`
473476
(2.19.0)
477+
478+
Fawzi Essam (@iifawzi)
479+
* Contributed fix for #1412: More cases of Non-blocking parser reporting incorrect locations
480+
when fed with non-zero offset
481+
(2.19.0)

release-notes/VERSION-2.x

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ a pure JSON library.
2626
at root level
2727
#1407: [gradle-module-metadata-maven-plugin] update to version 1.0
2828
(contributed by @jjohannes)
29+
#1412: More cases of Non-blocking parser reporting incorrect locations
30+
when fed with non-zero offset
31+
(reported by David N)
32+
(fixed by Fawzi E)
2933

3034
2.18.3 (28-Feb-2025)
3135

src/main/java/com/fasterxml/jackson/core/json/async/NonBlockingUtf8JsonParserBase.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,8 @@ public JsonToken nextToken() throws IOException
138138

139139
// No: fresh new token; may or may not have existing one
140140
_numTypesValid = NR_UNKNOWN;
141-
_tokenInputTotal = _currInputProcessed + _inputPtr;
141+
_tokenInputTotal = _currInputProcessed + (_inputPtr - _currBufferStart);
142+
142143
// also: clear any data retained so far
143144
_binaryValue = null;
144145
int ch = getNextUnsignedByteFromBuffer();

src/test/java/com/fasterxml/jackson/core/tofix/async/AsyncLocation1412Test.java renamed to src/test/java/com/fasterxml/jackson/core/json/async/AsyncLocation1412Test.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ void feedByteByByteFromOffsetZero() throws Exception {
7676
}
7777
}
7878

79-
@JacksonTestFailureExpected
8079
@Test
8180
@DisplayName("Feed one byte at a time from non-zero array offset")
8281
void feedByteByByteFromNonZeroOffset() throws Exception {
@@ -94,7 +93,6 @@ void feedByteByByteFromNonZeroOffset() throws Exception {
9493
}
9594
}
9695

97-
@JacksonTestFailureExpected
9896
@Test
9997
@DisplayName("Feed whole document at once from non-zero array offset")
10098
void feedWholeDocumentFromNonZeroOffset() throws Exception {

0 commit comments

Comments
 (0)