Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-70793

Form validation does not clear previous errors (regression in 2.355)

    • 2.427, 2.426.1

      Noting https://github.com/jenkinsci/jenkins/pull/6460#issuecomment-1466841649 from jglick 


      This breaks form validation—errors are not properly cleared and replaced with new errors. (Noticed in https://github.com/jenkinsci/ldap-plugin/pull/185#issuecomment-1460028705.) Reproducible in 2.355 but not 2.354 from /configureSecurity/ with a trivial plugin:

      import hudson.Extension;
      import hudson.model.Descriptor;
      import hudson.security.SecurityRealm;
      import hudson.util.FormValidation;
      import org.kohsuke.stapler.DataBoundConstructor;
      import org.kohsuke.stapler.QueryParameter;
      public final class XSecurityRealm extends SecurityRealm {
          public final String v;
          @DataBoundConstructor public XSecurityRealm(String v) {
              this.v = v;
          }
          @Override public SecurityComponents createSecurityComponents() {
              throw new UnsupportedOperationException();
          }
          @Extension public static final class DescriptorImpl extends Descriptor<SecurityRealm> {
              @Override public String getDisplayName() {
                  return "X";
              }
              public FormValidation doCheckV(@QueryParameter String v) {
                  return FormValidation.error(new IllegalStateException("Processing " + v), "Could not process " + v);
              }
          }
      }
      
      <?xml version="1.0" encoding="UTF-8"?>
      <?jelly escape-by-default='true'?>
      <j:jelly xmlns:j="jelly:core" xmlns:f="/lib/form">
          <f:entry field="v" title="Some value">
              <f:textbox/>
          </f:entry>
      </j:jelly>
      

          [JENKINS-70793] Form validation does not clear previous errors (regression in 2.355)

          Daniel Beck created issue -
          Jesse Glick made changes -
          Link New: This issue is caused by JENKINS-68373 [ JENKINS-68373 ]
          Basil Crow made changes -
          Description Original: Noting [https://github.com/jenkinsci/jenkins/pull/6460#issuecomment-1466841649] from [~jglick] 
          ----
          This breaks form validation—errors are not properly cleared and replaced with new errors. (Noticed in [https://github.com/jenkinsci/ldap-plugin/pull/185#issuecomment-1460028705].) Reproducible in 2.355 but not 2.354 from {{/configureSecurity/}} with a trivial plugin:
          {noformat}
          import hudson.Extension;
          import hudson.model.Descriptor;
          import hudson.security.SecurityRealm;
          import hudson.util.FormValidation;
          import org.kohsuke.stapler.DataBoundConstructor;
          import org.kohsuke.stapler.QueryParameter;
          public final class XSecurityRealm extends SecurityRealm {
              public final String v;
              @DataBoundConstructor public XSecurityRealm(String v) {
                  this.v = v;
              }
              @Override public SecurityComponents createSecurityComponents() {
                  throw new UnsupportedOperationException();
              }
              @Extension public static final class DescriptorImpl extends Descriptor<SecurityRealm> {
                  @Override public String getDisplayName() {
                      return "X";
                  }
                  public FormValidation doCheckV(@QueryParameter String v) {
                      return FormValidation.error(new IllegalStateException("Processing " + v), "Could not process " + v);
                  }
              }
          }
          {noformat}
          {noformat}
          <?xml version="1.0" encoding="UTF-8"?>
          <?jelly escape-by-default='true'?>
          <j:jelly xmlns:j="jelly:core" xmlns:f="/lib/form">
              <f:entry field="v" title="Some value">
                  <f:textbox/>
              </f:entry>
          </j:jelly>
          {noformat}
          New: Noting [https://github.com/jenkinsci/jenkins/pull/6460#issuecomment-1466841649] from [~jglick] 
          ----
          This breaks form validation—errors are not properly cleared and replaced with new errors. (Noticed in [https://github.com/jenkinsci/ldap-plugin/pull/185#issuecomment-1460028705].) Reproducible in 2.355 but not 2.354 from {{/configureSecurity/}} with a trivial plugin:
          {code:java}
          import hudson.Extension;
          import hudson.model.Descriptor;
          import hudson.security.SecurityRealm;
          import hudson.util.FormValidation;
          import org.kohsuke.stapler.DataBoundConstructor;
          import org.kohsuke.stapler.QueryParameter;
          public final class XSecurityRealm extends SecurityRealm {
              public final String v;
              @DataBoundConstructor public XSecurityRealm(String v) {
                  this.v = v;
              }
              @Override public SecurityComponents createSecurityComponents() {
                  throw new UnsupportedOperationException();
              }
              @Extension public static final class DescriptorImpl extends Descriptor<SecurityRealm> {
                  @Override public String getDisplayName() {
                      return "X";
                  }
                  public FormValidation doCheckV(@QueryParameter String v) {
                      return FormValidation.error(new IllegalStateException("Processing " + v), "Could not process " + v);
                  }
              }
          }
          {code}
          {code:xml}
          <?xml version="1.0" encoding="UTF-8"?>
          <?jelly escape-by-default='true'?>
          <j:jelly xmlns:j="jelly:core" xmlns:f="/lib/form">
              <f:entry field="v" title="Some value">
                  <f:textbox/>
              </f:entry>
          </j:jelly>
          {code}
          Daniel Beck made changes -
          Attachment New: Sample plugin demonstrating impact.png [ 61050 ]
          Daniel Beck made changes -
          Assignee New: Daniel Beck [ danielbeck ]
          Daniel Beck made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]
          Daniel Beck made changes -
          Status Original: In Progress [ 3 ] New: In Review [ 10005 ]
          Daniel Beck made changes -
          Remote Link New: This issue links to "PR 8422 (Web Link)" [ 28899 ]
          Basil Crow made changes -
          Released As New: 2.427
          Resolution New: Fixed [ 1 ]
          Status Original: In Review [ 10005 ] New: Closed [ 6 ]
          Daniel Beck made changes -
          Labels Original: regression ux New: lts-candidate regression ux
          Mark Waite made changes -
          Labels Original: lts-candidate regression ux New: 2.426.1-fixed regression ux

            danielbeck Daniel Beck
            danielbeck Daniel Beck
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: