From 8055117ddb27f8f113869a99a8091ad7ac37f872 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 Signed-off-by: Shivansh Arora --- CHANGELOG.md | 1 + libs/grok/build.gradle | 2 +- libs/grok/licenses/joni-2.1.48.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.48.jar.sha1 create mode 100644 libs/grok/licenses/joni-2.2.1.jar.sha1 diff --git a/CHANGELOG.md b/CHANGELOG.md index ae670546a1f14..5a186ba702033 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -108,6 +108,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - Bump `com.google.guava:guava` from 32.0.0-jre to 32.0.1-jre (#8009) - 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 `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 2e3cf8d45ceab..97cf68a7971fa 100644 --- a/libs/grok/build.gradle +++ b/libs/grok/build.gradle @@ -29,7 +29,7 @@ */ dependencies { - api 'org.jruby.joni:joni:2.1.48' + 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.48.jar.sha1 b/libs/grok/licenses/joni-2.1.48.jar.sha1 deleted file mode 100644 index 4ac2f3842559b..0000000000000 --- a/libs/grok/licenses/joni-2.1.48.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -552f95e640553de15243c02bd97a6c0c3dd7a78f \ 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. }