mattyb149 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_r252822065
 
 

 ##########
 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:
   Should we catch and rethrow the exceptions from the signature, then catch 
Throwable, to cover all our bases?

----------------------------------------------------------------
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

Reply via email to