[ https://issues.apache.org/jira/browse/NIFI-7055?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17021227#comment-17021227 ]
Otto Fowler commented on NIFI-7055: ----------------------------------- OK. This is the way it currently works without my change to handle String[0]: ||INPUT STRING||VALIDATOR ACTIONS||RESULT|| |","|String[0] no validator called| valid| |",,,,,"|String[0] no validator called | valid | |",foo"|validator called for empty and for foo| invalid| |"foo,"|validator for foo, trailing empty not returned from split| valid| I am not sure this is right. It is certainly not consistent. I would think we would want the validator to be called based on exclude empty in all cases, not dependent on the string.split workings. String.split(string, -1) will always return the list sized to the input with empties.... but that breaks the existing behavior for "foo," where we expect it to be ignored. I am not sure how to handle all these cases without regression. Maybe the fix is to handle String[0], leave the rest as is, and create a new validator that uses split -1? [~joewitt]? [~woutifier]? > createListValidator returns valid for empty list with "," input > --------------------------------------------------------------- > > Key: NIFI-7055 > URL: https://issues.apache.org/jira/browse/NIFI-7055 > Project: Apache NiFi > Issue Type: Bug > Reporter: Otto Fowler > Assignee: Otto Fowler > Priority: Major > > from Slack: > <wouter.devr...@tesorion.nl> > "I'm looking at the createListValidator, and to my surprise passing in a list > of (essentially) two empty elements "," validates, while a totally empty > string "" does not. Apparently due to some underlying behavior of > String.split." > The string "," does return a String[0] from split. This should fail > validation as if here were no elements as null, "", " " do possibly. > But that kind of goes against or doesn't consider the ignore empty entries. > I think the difference is whether or not you consider "," to be a list of two > empty elements or an empty list. > The current implementation with String.spilt() will produce an empty list. > Is that correct? -- This message was sent by Atlassian Jira (v8.3.4#803005)