|
1 | 1 | /*
|
2 |
| - * Copyright 2014 Anthony Corbacho, and contributors. |
3 |
| - * |
4 | 2 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 3 | * you may not use this file except in compliance with the License.
|
6 | 4 | * You may obtain a copy of the License at
|
|
24 | 22 | import java.io.InputStreamReader;
|
25 | 23 | import java.io.Reader;
|
26 | 24 | import java.io.Serializable;
|
| 25 | +import java.nio.charset.Charset; |
27 | 26 | import java.nio.file.Files;
|
28 | 27 | import java.util.ArrayList;
|
29 | 28 | import java.util.HashMap;
|
|
51 | 50 | * @since 0.0.1
|
52 | 51 | * @author anthonycorbacho
|
53 | 52 | */
|
| 53 | +// Note: this code is forked from oi.thekraken.grok.api |
| 54 | +// Copyright 2014 Anthony Corbacho, and contributors. |
54 | 55 | public class Grok
|
55 | 56 | implements Serializable
|
56 | 57 | {
|
@@ -244,7 +245,7 @@ public static Grok create(String grokPatternPath, String grokDatatypePath, Strin
|
244 | 245 | static Reader getFileFromResouces(String filePath)
|
245 | 246 | throws GrokException
|
246 | 247 | {
|
247 |
| - Reader reader = new InputStreamReader(Grok.class.getClassLoader().getResourceAsStream(filePath)); |
| 248 | + Reader reader = new InputStreamReader(Grok.class.getClassLoader().getResourceAsStream(filePath), Charset.defaultCharset()); |
248 | 249 | if (reader == null) {
|
249 | 250 | throw new GrokException("File <" + filePath + "> not found.");
|
250 | 251 | }
|
@@ -593,7 +594,7 @@ public void compile(String pattern, boolean namedOnly)
|
593 | 594 | // Match %{Foo=regex} -> add new regex definition
|
594 | 595 | if (m.find()) {
|
595 | 596 | continueIteration = true;
|
596 |
| - Map<String, String> group = GrokUtils.namedGroups(m, m.group()); // AMZN - probably don't need this tag since it's going into OSS Trino |
| 597 | + Map<String, String> group = GrokUtils.namedGroups(m, m.group()); |
597 | 598 | if (group.get("definition") != null) {
|
598 | 599 | try {
|
599 | 600 | addPattern(group.get("pattern"), group.get("definition"));
|
@@ -692,9 +693,9 @@ public String getSaved_pattern()
|
692 | 693 | return savedPattern;
|
693 | 694 | }
|
694 | 695 |
|
695 |
| - public void setSaved_pattern(String savedpattern) |
| 696 | + public void setSaved_pattern(String savedPattern) |
696 | 697 | {
|
697 |
| - this.savedPattern = savedpattern; |
| 698 | + this.savedPattern = savedPattern; |
698 | 699 | }
|
699 | 700 |
|
700 | 701 | public boolean getStrictMode()
|
|
0 commit comments