ekovacs commented on issue #3282: NIFI-5983: handling parse problems in 
recordReader implementations
URL: https://github.com/apache/nifi/pull/3282#issuecomment-460696337
 
 
   Thanks Matt, the changes are pushed now.
   
   
   On Tue, Feb 5, 2019 at 3:21 PM Matthew Burgess <[email protected]>
   wrote:
   
   > *@mattyb149* commented on this pull request.
   > ------------------------------
   >
   > In
   > 
nifi-nar-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/csv/ITApacheCSVRecordReader.java
   > <https://github.com/apache/nifi/pull/3282#discussion_r253881736>:
   >
   > > @@ -27,22 +28,30 @@
   >  import org.junit.Test;
   >  import org.mockito.Mockito;
   >
   > +import avro.shaded.com.google.common.base.Throwables;
   >
   > This avro.shaded class is back :P
   > ------------------------------
   >
   > In
   > 
nifi-nar-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/csv/ITApacheCSVRecordReader.java
   > <https://github.com/apache/nifi/pull/3282#discussion_r253882016>:
   >
   > > +        CSVFormat csvFormat = 
CSVFormat.DEFAULT.withFirstRecordAsHeader().withQuoteMode(QuoteMode.ALL).withTrim().withDelimiter(',');
   > +        final int NUM_LINES = 25;
   > +        StringBuilder sb = new 
StringBuilder("\"id\",\"name\",\"balance\"");
   > +        for (int i = 0; i < NUM_LINES; i++) {
   > +            sb.append(String.format("\"%s\",\"John Doe\",\"4750.89D\"\n", 
i));
   > +        }
   > +        // cause a parse problem
   > +        sb.append(String.format("\"%s\"dieParser,\"John 
Doe\",\"4750.89D\"\n", NUM_LINES ));
   > +        sb.append(String.format("\"%s\",\"John Doe\",\"4750.89D\"\n", 
NUM_LINES + 1));
   > +        final RecordSchema schema = new 
SimpleRecordSchema(createStringFields(new String[] {"id", "name", "balance"}));
   > +
   > +        try (final InputStream bais = new 
ByteArrayInputStream(sb.toString().getBytes());
   > +             final CSVRecordReader reader = new CSVRecordReader(bais, 
Mockito.mock(ComponentLog.class), schema, csvFormat, true, false,
   > +                     RecordFieldType.DATE.getDefaultFormat(), 
RecordFieldType.TIME.getDefaultFormat(), 
RecordFieldType.TIMESTAMP.getDefaultFormat(), "UTF-8")) {
   > +
   > +            @SuppressWarnings("unused")
   >
   > Rather than this annotation, you can probably just replace the while with 
while
   > (reader.nextRecord() != null) ?
   >
   > —
   > You are receiving this because you authored the thread.
   > Reply to this email directly, view it on GitHub
   > <https://github.com/apache/nifi/pull/3282#pullrequestreview-200096805>,
   > or mute the thread
   > 
<https://github.com/notifications/unsubscribe-auth/ABaM1vid5midhFYA_P721uscfkusEN3Eks5vKZNsgaJpZM4actZy>
   > .
   >
   

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