From 76be06d47475bb42e44a79da2b19fd1584ede579 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 13 Jun 2023 16:16:22 -0700 Subject: [PATCH] Bump org.jruby.joni:joni from 2.1.48 to 2.2.1 in /libs/grok (#8015) * Bump org.jruby.joni:joni from 2.1.48 to 2.2.1 in /libs/grok Bumps [org.jruby.joni:joni](https://github.com/jruby/joni) from 2.1.48 to 2.2.1. - [Commits](https://github.com/jruby/joni/compare/joni-2.1.48...joni-2.2.1) --- updated-dependencies: - dependency-name: org.jruby.joni:joni dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Updating SHAs Signed-off-by: dependabot[bot] * Update changelog Signed-off-by: dependabot[bot] * Update method calls to Region beginning and end The "beg" and "end" public members were marked as deprecated in v2.1.47, with direct access being removed in v2.2.0. "getBeg()" and "getEnd()" are now available instead. Signed-off-by: Kartik Ganesh * Spotless Signed-off-by: Kartik Ganesh --------- Signed-off-by: dependabot[bot] Signed-off-by: Kartik Ganesh Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: dependabot[bot] Co-authored-by: Kartik Ganesh (cherry picked from commit 95135ec32123e0b60d3be90e31b095d62faa3033) --- CHANGELOG.md | 1 + libs/grok/build.gradle | 2 +- libs/grok/licenses/joni-2.1.44.jar.sha1 | 1 - libs/grok/licenses/joni-2.2.1.jar.sha1 | 1 + libs/grok/src/main/java/org/opensearch/grok/Grok.java | 11 ++++++++--- .../java/org/opensearch/grok/GrokCaptureType.java | 6 +++--- 6 files changed, 14 insertions(+), 8 deletions(-) delete mode 100644 libs/grok/licenses/joni-2.1.44.jar.sha1 create mode 100644 libs/grok/licenses/joni-2.2.1.jar.sha1 diff --git a/CHANGELOG.md b/CHANGELOG.md index a3c88ed5594ce..2a8fd645b470c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - Bump `commons-io:commons-io` from 2.12.0 to 2.13.0 (#8014, #8013, #8010) - Bump `com.diffplug.spotless` from 6.18.0 to 6.19.0 (#8007) - Bump `'com.azure:azure-storage-blob` to 12.22.2 from 12.21.1 ([#8043](https://github.com/opensearch-project/OpenSearch/pull/8043)) +- Bump `org.jruby.joni:joni` from 2.1.48 to 2.2.1 (#8015) ### Changed - Replace jboss-annotations-api_1.2_spec with jakarta.annotation-api ([#7836](https://github.com/opensearch-project/OpenSearch/pull/7836)) diff --git a/libs/grok/build.gradle b/libs/grok/build.gradle index 43a55f84b9d55..97cf68a7971fa 100644 --- a/libs/grok/build.gradle +++ b/libs/grok/build.gradle @@ -29,7 +29,7 @@ */ dependencies { - api 'org.jruby.joni:joni:2.1.44' + api 'org.jruby.joni:joni:2.2.1' // joni dependencies: api 'org.jruby.jcodings:jcodings:1.0.58' diff --git a/libs/grok/licenses/joni-2.1.44.jar.sha1 b/libs/grok/licenses/joni-2.1.44.jar.sha1 deleted file mode 100644 index bff9ca56f7e8c..0000000000000 --- a/libs/grok/licenses/joni-2.1.44.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -35746c2aee04ce459a2aa8dc2d626946c5dfb051 \ No newline at end of file diff --git a/libs/grok/licenses/joni-2.2.1.jar.sha1 b/libs/grok/licenses/joni-2.2.1.jar.sha1 new file mode 100644 index 0000000000000..d0338540f5512 --- /dev/null +++ b/libs/grok/licenses/joni-2.2.1.jar.sha1 @@ -0,0 +1 @@ +23d2f2eff7fa0cda465d86ec9d8bab53e496d9e6 \ No newline at end of file diff --git a/libs/grok/src/main/java/org/opensearch/grok/Grok.java b/libs/grok/src/main/java/org/opensearch/grok/Grok.java index e80bde02360ed..2585916aae38b 100644 --- a/libs/grok/src/main/java/org/opensearch/grok/Grok.java +++ b/libs/grok/src/main/java/org/opensearch/grok/Grok.java @@ -214,8 +214,8 @@ private String groupMatch(String name, Region region, String pattern) { name.getBytes(StandardCharsets.UTF_8).length, region ); - int begin = region.beg[number]; - int end = region.end[number]; + int begin = region.getBeg(number); + int end = region.getEnd(number); return new String(pattern.getBytes(StandardCharsets.UTF_8), begin, end - begin, StandardCharsets.UTF_8); } catch (StringIndexOutOfBoundsException e) { return null; @@ -270,7 +270,12 @@ protected String toRegex(String grokPattern) { grokPart = String.format(Locale.US, "(?<%s>%s)", patternName + "_" + result, pattern); } String start = new String(grokPatternBytes, 0, result, StandardCharsets.UTF_8); - String rest = new String(grokPatternBytes, region.end[0], grokPatternBytes.length - region.end[0], StandardCharsets.UTF_8); + String rest = new String( + grokPatternBytes, + region.getEnd(0), + grokPatternBytes.length - region.getEnd(0), + StandardCharsets.UTF_8 + ); grokPattern = grokPart + rest; res.append(start); } diff --git a/libs/grok/src/main/java/org/opensearch/grok/GrokCaptureType.java b/libs/grok/src/main/java/org/opensearch/grok/GrokCaptureType.java index f5898414827ff..7f9555d01e386 100644 --- a/libs/grok/src/main/java/org/opensearch/grok/GrokCaptureType.java +++ b/libs/grok/src/main/java/org/opensearch/grok/GrokCaptureType.java @@ -105,9 +105,9 @@ protected final GrokCaptureExtracter rawExtracter(int[] backRefs, Consumer= 0) { - int matchOffset = offset + region.beg[number]; - int matchLength = region.end[number] - region.beg[number]; + if (region.getBeg(number) >= 0) { + int matchOffset = offset + region.getBeg(number); + int matchLength = region.getEnd(number) - region.getBeg(number); emit.accept(new String(utf8Bytes, matchOffset, matchLength, StandardCharsets.UTF_8)); return; // Capture only the first value. }