ekovacs commented on a change in pull request #3282: NIFI-5983: handling parse
problems in recordReader implementations
URL: https://github.com/apache/nifi/pull/3282#discussion_r252977997
##########
File path:
nifi-nar-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/main/java/org/apache/nifi/avro/AvroRecordReader.java
##########
@@ -33,14 +35,18 @@
@Override
public Record nextRecord(final boolean coerceTypes, final boolean
dropUnknownFields) throws IOException, MalformedRecordException {
- GenericRecord record = nextAvroRecord();
- if (record == null) {
- return null;
+ try {
+ GenericRecord record = nextAvroRecord();
+ if (record == null) {
+ return null;
+ }
+
+ final RecordSchema schema = getSchema();
+ final Map<String, Object> values =
AvroTypeUtil.convertAvroRecordToMap(record, schema);
+ return new MapRecord(schema, values);
+ } catch (RuntimeException e) {
Review comment:
indeed!
However I was only able to add the catch clauses here in AvroRecordReader
and not into CSVRecordReader: since the compiler checks the try {} 's body, and
finds that it never throws those checked exceptions.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services