[
https://issues.apache.org/jira/browse/NIFI-4080?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16222932#comment-16222932
]
ASF GitHub Bot commented on NIFI-4080:
--------------------------------------
Github user mattyb149 commented on a diff in the pull request:
https://github.com/apache/nifi/pull/2226#discussion_r147526473
--- Diff:
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ValidateCsv.java
---
@@ -227,9 +231,9 @@ public void setPreference(final ProcessContext context)
{
// 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).getValue().replace("\\n",
"\n").replace("\\r", "\r").replace("\\t", "\t");
- this.preference.set(new
CsvPreference.Builder(context.getProperty(QUOTE_CHARACTER).getValue().charAt(0),
-
context.getProperty(DELIMITER_CHARACTER).getValue().charAt(0),
msgDemarcator).build());
+ final String msgDemarcator =
context.getProperty(END_OF_LINE_CHARACTER).evaluateAttributeExpressions().getValue().replace("\\n",
"\n").replace("\\r", "\r").replace("\\t", "\t");
+ this.preference.set(new
CsvPreference.Builder(context.getProperty(QUOTE_CHARACTER).evaluateAttributeExpressions().getValue().charAt(0),
+
context.getProperty(DELIMITER_CHARACTER).evaluateAttributeExpressions().getValue().charAt(0),
msgDemarcator).build());
--- End diff --
That would be more useful, this was initially just a quick addition. There
is something funky with unit tests when you call isExpressionLanguagePresent()
from a custom validator, it throws an NPE. I will look into that and try to
move it into onTrigger(). However if for some reason there is a property that
must be evaluated early, or too much overhead in building the CsvPreference
(not saying there is, just saying if there is), then I'd rather have all the
properties either support flow file attributes or none, how does that sound?
> ValidateCSV - Add support for Expression Language
> --------------------------------------------------
>
> Key: NIFI-4080
> URL: https://issues.apache.org/jira/browse/NIFI-4080
> Project: Apache NiFi
> Issue Type: Improvement
> Reporter: Matt Burgess
> Assignee: Matt Burgess
>
> The ValidateCSV processor could benefit if the following fields supported
> Expression Language evaluation:
> - Schema
> - Quote character
> - Delimiter character
> - End of line symbols
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)