diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 28d2a42d42..e484692ee2 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -25,7 +25,7 @@ jobs: strategy: fail-fast: false matrix: - java_version: ['8', '11', '17', '21', '23'] + java_version: ['8', '17', '21', '23'] # We will actually need "os" as Matrix to have Windows build os: ['ubuntu-22.04'] include: diff --git a/release-notes/CREDITS-2.x b/release-notes/CREDITS-2.x index fa4ae6896b..c04983bc85 100644 --- a/release-notes/CREDITS-2.x +++ b/release-notes/CREDITS-2.x @@ -214,6 +214,9 @@ David Nault (dnault@github) * Reported #531: Non-blocking parser reports incorrect locations when fed with non-zero offset (2.10.0) + * Reported 1412: More cases of Non-blocking parser reporting incorrect locations + when fed with non-zero offset + (2.19.0) Fabien Renaud (fabienrenaud@github) * Reported, contributed fix for #533: UTF-8 BOM not accounted for in @@ -471,3 +474,8 @@ Eduard Gomoliako (@Gems) * Contributed #1356: Make `JsonGenerator::writeTypePrefix` method to not write a `WRAPPER_ARRAY` when `typeIdDef.id == null` (2.19.0) + +Fawzi Essam (@iifawzi) + * Contributed fix for #1412: More cases of Non-blocking parser reporting incorrect locations + when fed with non-zero offset + (2.19.0) diff --git a/release-notes/VERSION-2.x b/release-notes/VERSION-2.x index 74558d323f..490ab0d858 100644 --- a/release-notes/VERSION-2.x +++ b/release-notes/VERSION-2.x @@ -26,6 +26,10 @@ a pure JSON library. at root level #1407: [gradle-module-metadata-maven-plugin] update to version 1.0 (contributed by @jjohannes) +#1412: More cases of Non-blocking parser reporting incorrect locations + when fed with non-zero offset + (reported by David N) + (fixed by Fawzi E) 2.18.3 (28-Feb-2025) diff --git a/src/main/java/com/fasterxml/jackson/core/json/async/NonBlockingUtf8JsonParserBase.java b/src/main/java/com/fasterxml/jackson/core/json/async/NonBlockingUtf8JsonParserBase.java index a6a18c0ff9..622e9aee25 100644 --- a/src/main/java/com/fasterxml/jackson/core/json/async/NonBlockingUtf8JsonParserBase.java +++ b/src/main/java/com/fasterxml/jackson/core/json/async/NonBlockingUtf8JsonParserBase.java @@ -138,7 +138,8 @@ public JsonToken nextToken() throws IOException // No: fresh new token; may or may not have existing one _numTypesValid = NR_UNKNOWN; - _tokenInputTotal = _currInputProcessed + _inputPtr; + _tokenInputTotal = _currInputProcessed + (_inputPtr - _currBufferStart); + // also: clear any data retained so far _binaryValue = null; int ch = getNextUnsignedByteFromBuffer(); diff --git a/src/test/java/com/fasterxml/jackson/core/tofix/async/AsyncLocation1412Test.java b/src/test/java/com/fasterxml/jackson/core/json/async/AsyncLocation1412Test.java similarity index 98% rename from src/test/java/com/fasterxml/jackson/core/tofix/async/AsyncLocation1412Test.java rename to src/test/java/com/fasterxml/jackson/core/json/async/AsyncLocation1412Test.java index 82dbf301c5..5e409d3e4e 100644 --- a/src/test/java/com/fasterxml/jackson/core/tofix/async/AsyncLocation1412Test.java +++ b/src/test/java/com/fasterxml/jackson/core/json/async/AsyncLocation1412Test.java @@ -76,7 +76,6 @@ void feedByteByByteFromOffsetZero() throws Exception { } } - @JacksonTestFailureExpected @Test @DisplayName("Feed one byte at a time from non-zero array offset") void feedByteByByteFromNonZeroOffset() throws Exception { @@ -94,7 +93,6 @@ void feedByteByByteFromNonZeroOffset() throws Exception { } } - @JacksonTestFailureExpected @Test @DisplayName("Feed whole document at once from non-zero array offset") void feedWholeDocumentFromNonZeroOffset() throws Exception {