Skip to content

Commit

Permalink
Bump org.jruby.joni:joni from 2.1.48 to 2.2.1 in /libs/grok (#8015)
Browse files Browse the repository at this point in the history
* 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] <[email protected]>

* Updating SHAs

Signed-off-by: dependabot[bot] <[email protected]>

* Update changelog

Signed-off-by: dependabot[bot] <[email protected]>

* 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 <[email protected]>

* Spotless

Signed-off-by: Kartik Ganesh <[email protected]>

---------

Signed-off-by: dependabot[bot] <[email protected]>
Signed-off-by: Kartik Ganesh <[email protected]>
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 <[email protected]>
(cherry picked from commit 95135ec)
  • Loading branch information
dependabot[bot] authored and kartg committed Jun 14, 2023
1 parent 36cb772 commit a664aef
Show file tree
Hide file tree
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
Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion libs/grok/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down
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
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
}
Expand Down

0 comments on commit a664aef

Please sign in to comment.