Github user markap14 commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/365#discussion_r60290762
  
    --- Diff: 
nifi-commons/nifi-processor-utilities/src/main/java/org/apache/nifi/processor/util/StandardValidators.java
 ---
    @@ -127,12 +127,26 @@ public ValidationResult validate(final String 
subject, final String value, final
     
         public static final Validator PORT_VALIDATOR = createLongValidator(1, 
65535, true);
     
    +    /**
    +     * {@link Validator} that ensures that value's length > 0
    +     */
         public static final Validator NON_EMPTY_VALIDATOR = new Validator() {
             @Override
             public ValidationResult validate(final String subject, final 
String value, final ValidationContext context) {
                 return new 
ValidationResult.Builder().subject(subject).input(value).valid(value != null && 
!value.isEmpty()).explanation(subject + " cannot be empty").build();
             }
         };
    +    
    +    /**
    +     * {@link Validator} that ensures that value has 1+ non-whitespace
    +     * characters
    +     */
    +    public static final Validator NON_BLANK_VALIDATOR = new Validator() {
    +        @Override
    +        public ValidationResult validate(final String subject, final 
String value, final ValidationContext context) {
    +            return new 
ValidationResult.Builder().subject(subject).input(value).valid(value != null && 
!value.trim().isEmpty()).explanation(subject + " cannot be empty").build();
    --- End diff --
    
    For the explanation, rather than indicating that it cannot be empty, i 
would indicate "must contain at least one character that is not white space"


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to