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

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

XMLWordPrintable

    • 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>
      

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

              Created:
              Updated:
              Resolved: