Uploaded image for project: 'WildFly Core'
  1. WildFly Core
  2. WFCORE-1590

Default parameter length validating ignores setMinSize(0)

XMLWordPrintable

    • Workaround Exists
    • Hide

      Manually provide a StringLengthValidator: -

          static final SimpleAttributeDefinition REPLACEMENT = new SimpleAttributeDefinitionBuilder(ElytronDescriptionConstants.REPLACEMENT, ModelType.STRING, false)
              .setAllowExpression(true)
              .setValidator(new StringLengthValidator(0))
              .setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES)
              .build();
      
      Show
      Manually provide a StringLengthValidator: - static final SimpleAttributeDefinition REPLACEMENT = new SimpleAttributeDefinitionBuilder(ElytronDescriptionConstants.REPLACEMENT, ModelType.STRING, false ) .setAllowExpression( true ) .setValidator( new StringLengthValidator(0)) .setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES) .build();

      With the following attribute definition: -

          static final SimpleAttributeDefinition REPLACEMENT = new SimpleAttributeDefinitionBuilder(ElytronDescriptionConstants.REPLACEMENT, ModelType.STRING, false)
              .setAllowExpression(true)
              .setMinSize(0)
              .setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES)
              .build();
      

      The following error is reported if an empty string is used as a parameter: -

      [standalone@localhost:9990 /] ./subsystem=elytron/regex-name-rewriter=strip-realm:add(pattern="@ELYTRON.ORG", replacement="", replace-all=true)
      {
          "outcome" => "failed",
          "failure-description" => "WFLYCTL0113: '' is an invalid value for parameter replacement. Values must have a minimum length of 1 characters",
          "rolled-back" => true
      }
      

              bstansbe@redhat.com Brian Stansberry
              darran.lofthouse@redhat.com Darran Lofthouse
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: