pvillard31 commented on code in PR #10279:
URL: https://github.com/apache/nifi/pull/10279#discussion_r2325316162
##########
nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ValidateCsv.java:
##########
@@ -265,9 +281,31 @@ public CsvPreference getPreference(final ProcessContext
context, final FlowFile
// input is transferred over to Java as is. So when you type the
characters "\"
// and "n" into the UI the Java string will end up being those two
characters
// not the interpreted value "\n".
- final String msgDemarcator =
context.getProperty(END_OF_LINE_CHARACTER).evaluateAttributeExpressions(flowFile).getValue().replace("\\n",
"\n").replace("\\r", "\r").replace("\\t", "\t");
- return new
CsvPreference.Builder(context.getProperty(QUOTE_CHARACTER).evaluateAttributeExpressions(flowFile).getValue().charAt(0),
-
context.getProperty(DELIMITER_CHARACTER).evaluateAttributeExpressions(flowFile).getValue().charAt(0),
msgDemarcator).build();
+ final String msgDemarcator = context.getProperty(END_OF_LINE_CHARACTER)
+ .evaluateAttributeExpressions(flowFile)
+ .getValue()
+ .replace("\\n", "\n")
+ .replace("\\r", "\r")
+ .replace("\\t", "\t");
+
+ final char quoteChar = context.getProperty(QUOTE_CHARACTER)
+ .evaluateAttributeExpressions(flowFile)
+ .getValue()
+ .charAt(0);
+
+ final int delimiterChar = context.getProperty(DELIMITER_CHARACTER)
+ .evaluateAttributeExpressions(flowFile)
+ .getValue()
+ .charAt(0);
+
+ int maxLinesPerRow = 0;
+ if (context.getProperty(MAX_LINES_PER_ROW).isSet()) {
+ maxLinesPerRow =
context.getProperty(MAX_LINES_PER_ROW).asInteger();
+ }
Review Comment:
This is true, only if changing the property to `.required(true)` which is
probably a good idea given that we provide a default.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]