Skip to content

Commit 1cd3e06

Browse files
authored
Merge pull request apache#14 from hejiang2000/flume-1.8-hejiang-header-join-interceptor
修改 joinKeys 默认值为 key,简化代码。
2 parents ab558cc + d49e297 commit 1cd3e06

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

flume-ng-core/src/main/java/org/apache/flume/interceptor/HeaderJoinInterceptor.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,7 @@ public class HeaderJoinInterceptor implements Interceptor {
7676
private HeaderJoinInterceptor(String joinKeys, String joinKeyDefaultValues,
7777
String joinDelimiter, boolean preserveExisting,
7878
String key) {
79-
this.joinKeys = (joinKeys == null || joinKeys.isEmpty())
80-
? new String[]{ key } : joinKeys.split(" ");
79+
this.joinKeys = joinKeys.split(" ");
8180
this.joinKeyDefaultValues = joinKeyDefaultValues.split(" ");
8281
this.joinDelimiter = joinDelimiter;
8382
this.preserveExisting = preserveExisting;
@@ -162,7 +161,7 @@ public Interceptor build() {
162161

163162
public static class Constants {
164163
public static final String JOIN_KEYS = "joinKeys";
165-
public static final String JOIN_KEYS_DEFAULT = null;
164+
public static final String JOIN_KEYS_DEFAULT = "key";
166165

167166
public static final String JOIN_KEY_DEFAULT_VALUES = "joinKeyDefaultValues";
168167
public static final String JOIN_KEY_DEFAULT_VALUES_DEFAULT = "NA";

flume-ng-core/src/test/java/org/apache/flume/interceptor/TestHeaderJoinInterceptor.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,6 @@ public void testReplace() throws ClassNotFoundException,
107107
@Test
108108
public void testPreserve() throws ClassNotFoundException,
109109
InstantiationException, IllegalAccessException {
110-
Interceptor.Builder builder = InterceptorBuilderFactory.newInstance(
111-
InterceptorType.STATIC.toString());
112110
Context ctx = new Context();
113111
ctx.put(Constants.PRESERVE, "true");
114112
ctx.put(Constants.JOIN_KEY_DEFAULT_VALUES, "replacement+value");

0 commit comments

Comments
 (0)