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?


---

Reply via email to