Skip to content

Commit

Permalink
Bump org.jruby.joni:joni from 2.1.48 to 2.2.1 in /libs/grok (opensear…
Browse files Browse the repository at this point in the history
…ch-project#8015) (opensearch-project#8051)

* 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](jruby/joni@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] <support@github.com>

* Updating SHAs

Signed-off-by: dependabot[bot] <support@github.com>

* Update changelog

Signed-off-by: dependabot[bot] <support@github.com>

* 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 <gkart@amazon.com>

* Spotless

Signed-off-by: Kartik Ganesh <gkart@amazon.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Kartik Ganesh <gkart@amazon.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <dependabot[bot]@users.noreply.github.com>
Co-authored-by: Kartik Ganesh <gkart@amazon.com>
(cherry picked from commit 95135ec)

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
kartg and dependabot[bot] authored Jun 14, 2023
1 parent fa8aec4 commit a879fbc
Showing 6 changed files with 14 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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))
2 changes: 1 addition & 1 deletion libs/grok/build.gradle
Original file line number Diff line number Diff line change
@@ -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'

1 change: 0 additions & 1 deletion libs/grok/licenses/joni-2.1.44.jar.sha1

This file was deleted.

1 change: 1 addition & 0 deletions libs/grok/licenses/joni-2.2.1.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
23d2f2eff7fa0cda465d86ec9d8bab53e496d9e6
11 changes: 8 additions & 3 deletions libs/grok/src/main/java/org/opensearch/grok/Grok.java
Original file line number Diff line number Diff line change
@@ -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);
}
Original file line number Diff line number Diff line change
@@ -105,9 +105,9 @@ protected final GrokCaptureExtracter rawExtracter(int[] backRefs, Consumer<? sup
@Override
void extract(byte[] utf8Bytes, int offset, Region region) {
for (int number : backRefs) {
if (region.beg[number] >= 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.
}

0 comments on commit a879fbc

Please sign in to comment.