NIFI-8437 RecordReader 'Infer Schema' for large records may throw BufferedInputStream error

This closes #5011.

Signed-off-by: Mark Payne <markap14@hotmail.com>
This commit is contained in:
Denes Arvay 2021-04-20 10:00:47 +02:00 committed by Mark Payne
parent 92bdc23adb
commit 9f45b48866

View File

@ -46,7 +46,6 @@ import org.apache.nifi.serialization.SchemaRegistryService;
import org.apache.nifi.serialization.record.RecordSchema;
import org.codehaus.jackson.JsonNode;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
@ -164,9 +163,8 @@ public class JsonPathReader extends SchemaRegistryService implements RecordReade
@Override
public RecordReader createRecordReader(final Map<String, String> variables, final InputStream in, final long inputLength, final ComponentLog logger)
throws IOException, MalformedRecordException, SchemaNotFoundException {
final InputStream bufferedIn = new BufferedInputStream(in);
final RecordSchema schema = getSchema(variables, bufferedIn, null);
return new JsonPathRowRecordReader(jsonPaths, schema, bufferedIn, logger, dateFormat, timeFormat, timestampFormat);
final RecordSchema schema = getSchema(variables, in, null);
return new JsonPathRowRecordReader(jsonPaths, schema, in, logger, dateFormat, timeFormat, timestampFormat);
}
}