Skip to content

Commit 69bd4f4

Browse files
committed
Switch from RubyArray addAll to concat method to preserve the encoding and avoid implicit deconding in addAll iterator
1 parent 3a090a0 commit 69bd4f4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

logstash-core/src/main/java/org/logstash/common/BufferedTokenizerExt.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -85,22 +85,22 @@ public RubyArray extract(final ThreadContext context, IRubyObject data) {
8585
final RubyArray entities = data.convertToString().split(delimiter, -1);
8686
if (!bufferFullErrorNotified) {
8787
input.clear();
88-
input.addAll(entities);
88+
input.concat(entities);
8989
} else {
9090
// after a full buffer signal
9191
if (input.isEmpty()) {
9292
// after a buffer full error, the remaining part of the line, till next delimiter,
9393
// has to be consumed, unless the input buffer doesn't still contain fragments of
9494
// subsequent tokens.
9595
entities.shift(context);
96-
input.addAll(entities);
96+
input.concat(entities);
9797
} else {
9898
// merge last of the input with first of incoming data segment
9999
if (!entities.isEmpty()) {
100100
RubyString last = ((RubyString) input.pop(context));
101101
RubyString nextFirst = ((RubyString) entities.shift(context));
102102
entities.unshift(last.concat(nextFirst));
103-
input.addAll(entities);
103+
input.concat(entities);
104104
}
105105
}
106106
}

0 commit comments

Comments
 (0)