You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@nifi.apache.org by olegz <gi...@git.apache.org> on 2016/04/19 20:56:22 UTC

[GitHub] nifi pull request: NIFI-1785 added NON_BLANK_VALIDATOR

GitHub user olegz opened a pull request:

    https://github.com/apache/nifi/pull/365

    NIFI-1785 added  NON_BLANK_VALIDATOR

    

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/olegz/nifi NIFI-1785

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/nifi/pull/365.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #365
    
----
commit ec1ea71af2c1e5afe457dddc3f74db36bf09bbff
Author: Oleg Zhurakousky <ol...@suitcase.io>
Date:   2016-04-19T18:55:41Z

    NIFI-1785 added  NON_BLANK_VALIDATOR

----


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi pull request: NIFI-1785 added NON_BLANK_VALIDATOR

Posted by markap14 <gi...@git.apache.org>.
Github user markap14 commented on the pull request:

    https://github.com/apache/nifi/pull/365#issuecomment-212085785
  
    +1 this looks good to me.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi pull request: NIFI-1785 added NON_BLANK_VALIDATOR

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/nifi/pull/365


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi pull request: NIFI-1785 added NON_BLANK_VALIDATOR

Posted by markap14 <gi...@git.apache.org>.
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---