Skip to content
This repository has been archived by the owner on Sep 9, 2020. It is now read-only.

Commit

Permalink
Expensive for creating parser instance in execute() method.
Browse files Browse the repository at this point in the history
CSV parser is not thread safe

Closes #4
  • Loading branch information
johtani committed Sep 7, 2019
1 parent 611d9c4 commit e17ca1c
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@ public IngestDocument execute(IngestDocument ingestDocument) throws Exception {
String content = ingestDocument.getFieldValue(field, String.class);

if (Strings.hasLength(content)) {
String[] values = parser.parseLine(content);
String[] values;
synchronized (parser) {
values = parser.parseLine(content);
}
if (values.length != this.columns.size()) {
// TODO should be error?
throw new IllegalArgumentException("field[" + this.field + "] size ["
Expand Down

0 comments on commit e17ca1c

Please sign in to comment.