mirror of https://github.com/apache/nifi.git
NIFI-12587 - improve error message in ValidateCSV
review - removed row source from logging Update nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ValidateCsv.java Co-authored-by: dan-s1 <dstieg1@gmail.com> Update nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ValidateCsv.java Co-authored-by: dan-s1 <dstieg1@gmail.com> Update nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestValidateCsv.java Co-authored-by: dan-s1 <dstieg1@gmail.com> Update nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestValidateCsv.java Signed-off-by: Matt Burgess <mattyb149@apache.org> This closes #8224 Co-authored-by: dan-s1 <dstieg1@gmail.com>
This commit is contained in:
parent
60bde389df
commit
415505ea5d
|
@ -514,8 +514,11 @@ public class ValidateCsv extends AbstractProcessor {
|
|||
|
||||
} catch (final SuperCsvException e) {
|
||||
valid.set(false);
|
||||
final String coordinates = String.format("{line=%d, row=%d, column=%d}", e.getCsvContext().getLineNumber(),
|
||||
e.getCsvContext().getRowNumber(), e.getCsvContext().getColumnNumber());
|
||||
final String errorMessage = e.getLocalizedMessage() + " at " + coordinates;
|
||||
if(isWholeFFValidation) {
|
||||
validationError.set(e.getLocalizedMessage());
|
||||
validationError.set(errorMessage);
|
||||
logger.debug("Failed to validate {} against schema due to {}; routing to 'invalid'", flowFile, e);
|
||||
break;
|
||||
} else {
|
||||
|
@ -532,7 +535,7 @@ public class ValidateCsv extends AbstractProcessor {
|
|||
}
|
||||
|
||||
if(validationError.get() == null) {
|
||||
validationError.set(e.getLocalizedMessage());
|
||||
validationError.set(errorMessage);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
|
|
|
@ -122,7 +122,7 @@ public class TestValidateCsv {
|
|||
runner.run();
|
||||
runner.assertTransferCount(ValidateCsv.REL_INVALID, 1);
|
||||
runner.getFlowFilesForRelationship(ValidateCsv.REL_INVALID).get(0).assertAttributeEquals("validation.error.message",
|
||||
"'22/111954' could not be parsed as a Date");
|
||||
"'22/111954' could not be parsed as a Date at {line=1, row=1, column=2}");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -200,7 +200,7 @@ public class TestValidateCsv {
|
|||
runner.run();
|
||||
runner.assertTransferCount(ValidateCsv.REL_INVALID, 1);
|
||||
runner.getFlowFilesForRelationship(ValidateCsv.REL_INVALID).get(0).assertAttributeEquals("validation.error.message",
|
||||
"'testapache.org' does not match the regular expression '[a-z0-9\\._]+@[a-z0-9\\.]+'");
|
||||
"'testapache.org' does not match the regular expression '[a-z0-9\\._]+@[a-z0-9\\.]+' at {line=1, row=1, column=3}");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Reference in New Issue