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

@QueryParameter in form validation is not filled for dropdownDescriptorSelector when using nonpublic class

      I’m trying to use form validation on a dropdownDescriptorSelector, however here the validation method parameters (annotated with @QueryParameter) are not found and set to null (or 0). (If used standalone the validation works).

      Is there anything different with a dropdownDescriptorSelector? Or is this caused since the jelly views are in different plugins that use different class loaders?

      The relevant main jelly part:

      <f:entry description="${description.tool}">
      	<f:dropdownDescriptorSelector field="tool" title="${%title.tool}"
      		descriptors="${descriptor.availableTools}"/>
      </f:entry>
      

      (whole file: ScanForIssuesStep/config.jelly)

      The relevant jelly part of the referenced Describable:

      <f:entry title="${%High priority threshold}"
              description="${%Minimum number of duplicated lines for high priority warnings.}"
              field="highThreshold">
       <f:textbox default="50"/>
      </f:entry>
      

      (whole file: DuplicateCodeScanner/config.jelly)

      My validation method:

      public FormValidation doCheckHighThreshold(@QueryParameter final int highThreshold,
             @QueryParameter final int normalThreshold) {
         return VALIDATION.validateHigh(highThreshold, normalThreshold);
      }
      

      (whole file: DuplicateCodeScanner.java)

      Both parameters are always set to zero when setting a breakpoint here.

          [JENKINS-50355] @QueryParameter in form validation is not filled for dropdownDescriptorSelector when using nonpublic class

          Ulli Hafner created issue -
          Ulli Hafner made changes -
          Description Original: ’m trying to use form validation on a dropdownDescriptorSelector, however here the validation method parameters (annotated with @QueryParameter) are not found and set to null (or 0). (If used standalone the validation works).

          Is there anything different with a dropdownDescriptorSelector?

          The relevant main jelly part:

          {code}
          <f:entry description="${description.tool}">
          <f:dropdownDescriptorSelector field="tool" title="${%title.tool}"
          descriptors="${descriptor.availableTools}"/>
          </f:entry>
          {code}
          (whole file: [ScanForIssuesStep/config.jelly|https://github.com/jenkinsci/analysis-core-plugin/blob/3.0/src/main/resources/io/jenkins/plugins/analysis/core/steps/ScanForIssuesStep/config.jelly])

          The relevant jelly part of the referenced Describable:
          {code}
          <f:entry title="${%High priority threshold}"
                  description="${%Minimum number of duplicated lines for high priority warnings.}"
                  field="highThreshold">
           <f:textbox default="50"/>
          </f:entry>
          {code}
          (whole file: [DuplicateCodeScanner/config.jelly|https://github.com/jenkinsci/warnings-plugin/blob/3.0/src/main/resources/io/jenkins/plugins/analysis/warnings/DuplicateCodeScanner/config.jelly])

          My validation method:
          {code}
          public FormValidation doCheckHighThreshold(@QueryParameter final int highThreshold,
                 @QueryParameter final int normalThreshold) {
             return VALIDATION.validateHigh(highThreshold, normalThreshold);
          }
          {code}
          (whole file: [DuplicateCodeScanner.java|https://github.com/jenkinsci/warnings-plugin/blob/3.0/src/main/java/io/jenkins/plugins/analysis/warnings/DuplicateCodeScanner.java]
          Both parameters are always set to zero when setting a breakpoint here.
          New: I’m trying to use form validation on a dropdownDescriptorSelector, however here the validation method parameters (annotated with @QueryParameter) are not found and set to null (or 0). (If used standalone the validation works).

          Is there anything different with a dropdownDescriptorSelector? Or is this caused since the jelly views are in different plugins that use different class loaders?

          The relevant main jelly part:

          {code}
          <f:entry description="${description.tool}">
          <f:dropdownDescriptorSelector field="tool" title="${%title.tool}"
          descriptors="${descriptor.availableTools}"/>
          </f:entry>
          {code}
          (whole file: [ScanForIssuesStep/config.jelly|https://github.com/jenkinsci/analysis-core-plugin/blob/3.0/src/main/resources/io/jenkins/plugins/analysis/core/steps/ScanForIssuesStep/config.jelly])

          The relevant jelly part of the referenced Describable:
          {code}
          <f:entry title="${%High priority threshold}"
                  description="${%Minimum number of duplicated lines for high priority warnings.}"
                  field="highThreshold">
           <f:textbox default="50"/>
          </f:entry>
          {code}
          (whole file: [DuplicateCodeScanner/config.jelly|https://github.com/jenkinsci/warnings-plugin/blob/3.0/src/main/resources/io/jenkins/plugins/analysis/warnings/DuplicateCodeScanner/config.jelly])

          My validation method:
          {code}
          public FormValidation doCheckHighThreshold(@QueryParameter final int highThreshold,
                 @QueryParameter final int normalThreshold) {
             return VALIDATION.validateHigh(highThreshold, normalThreshold);
          }
          {code}
          (whole file: [DuplicateCodeScanner.java|https://github.com/jenkinsci/warnings-plugin/blob/3.0/src/main/java/io/jenkins/plugins/analysis/warnings/DuplicateCodeScanner.java]
          Both parameters are always set to zero when setting a breakpoint here.
          Ulli Hafner made changes -
          Description Original: I’m trying to use form validation on a dropdownDescriptorSelector, however here the validation method parameters (annotated with @QueryParameter) are not found and set to null (or 0). (If used standalone the validation works).

          Is there anything different with a dropdownDescriptorSelector? Or is this caused since the jelly views are in different plugins that use different class loaders?

          The relevant main jelly part:

          {code}
          <f:entry description="${description.tool}">
          <f:dropdownDescriptorSelector field="tool" title="${%title.tool}"
          descriptors="${descriptor.availableTools}"/>
          </f:entry>
          {code}
          (whole file: [ScanForIssuesStep/config.jelly|https://github.com/jenkinsci/analysis-core-plugin/blob/3.0/src/main/resources/io/jenkins/plugins/analysis/core/steps/ScanForIssuesStep/config.jelly])

          The relevant jelly part of the referenced Describable:
          {code}
          <f:entry title="${%High priority threshold}"
                  description="${%Minimum number of duplicated lines for high priority warnings.}"
                  field="highThreshold">
           <f:textbox default="50"/>
          </f:entry>
          {code}
          (whole file: [DuplicateCodeScanner/config.jelly|https://github.com/jenkinsci/warnings-plugin/blob/3.0/src/main/resources/io/jenkins/plugins/analysis/warnings/DuplicateCodeScanner/config.jelly])

          My validation method:
          {code}
          public FormValidation doCheckHighThreshold(@QueryParameter final int highThreshold,
                 @QueryParameter final int normalThreshold) {
             return VALIDATION.validateHigh(highThreshold, normalThreshold);
          }
          {code}
          (whole file: [DuplicateCodeScanner.java|https://github.com/jenkinsci/warnings-plugin/blob/3.0/src/main/java/io/jenkins/plugins/analysis/warnings/DuplicateCodeScanner.java]
          Both parameters are always set to zero when setting a breakpoint here.
          New: I’m trying to use form validation on a dropdownDescriptorSelector, however here the validation method parameters (annotated with @QueryParameter) are not found and set to null (or 0). (If used standalone the validation works).

          Is there anything different with a dropdownDescriptorSelector? Or is this caused since the jelly views are in different plugins that use different class loaders?

          The relevant main jelly part:

          {code}
          <f:entry description="${description.tool}">
          <f:dropdownDescriptorSelector field="tool" title="${%title.tool}"
          descriptors="${descriptor.availableTools}"/>
          </f:entry>
          {code}
          (whole file: [ScanForIssuesStep/config.jelly|https://github.com/jenkinsci/analysis-core-plugin/blob/3.0/src/main/resources/io/jenkins/plugins/analysis/core/steps/ScanForIssuesStep/config.jelly])

          The relevant jelly part of the referenced Describable:
          {code}
          <f:entry title="${%High priority threshold}"
                  description="${%Minimum number of duplicated lines for high priority warnings.}"
                  field="highThreshold">
           <f:textbox default="50"/>
          </f:entry>
          {code}
          (whole file: [DuplicateCodeScanner/config.jelly|https://github.com/jenkinsci/warnings-plugin/blob/3.0/src/main/resources/io/jenkins/plugins/analysis/warnings/DuplicateCodeScanner/config.jelly])

          My validation method:
          {code}
          public FormValidation doCheckHighThreshold(@QueryParameter final int highThreshold,
                 @QueryParameter final int normalThreshold) {
             return VALIDATION.validateHigh(highThreshold, normalThreshold);
          }
          {code}
          (whole file: [DuplicateCodeScanner.java|https://github.com/jenkinsci/warnings-plugin/blob/3.0/src/main/java/io/jenkins/plugins/analysis/warnings/DuplicateCodeScanner.java]

          Both parameters are always set to zero when setting a breakpoint here.
          Ulli Hafner made changes -
          Description Original: I’m trying to use form validation on a dropdownDescriptorSelector, however here the validation method parameters (annotated with @QueryParameter) are not found and set to null (or 0). (If used standalone the validation works).

          Is there anything different with a dropdownDescriptorSelector? Or is this caused since the jelly views are in different plugins that use different class loaders?

          The relevant main jelly part:

          {code}
          <f:entry description="${description.tool}">
          <f:dropdownDescriptorSelector field="tool" title="${%title.tool}"
          descriptors="${descriptor.availableTools}"/>
          </f:entry>
          {code}
          (whole file: [ScanForIssuesStep/config.jelly|https://github.com/jenkinsci/analysis-core-plugin/blob/3.0/src/main/resources/io/jenkins/plugins/analysis/core/steps/ScanForIssuesStep/config.jelly])

          The relevant jelly part of the referenced Describable:
          {code}
          <f:entry title="${%High priority threshold}"
                  description="${%Minimum number of duplicated lines for high priority warnings.}"
                  field="highThreshold">
           <f:textbox default="50"/>
          </f:entry>
          {code}
          (whole file: [DuplicateCodeScanner/config.jelly|https://github.com/jenkinsci/warnings-plugin/blob/3.0/src/main/resources/io/jenkins/plugins/analysis/warnings/DuplicateCodeScanner/config.jelly])

          My validation method:
          {code}
          public FormValidation doCheckHighThreshold(@QueryParameter final int highThreshold,
                 @QueryParameter final int normalThreshold) {
             return VALIDATION.validateHigh(highThreshold, normalThreshold);
          }
          {code}
          (whole file: [DuplicateCodeScanner.java|https://github.com/jenkinsci/warnings-plugin/blob/3.0/src/main/java/io/jenkins/plugins/analysis/warnings/DuplicateCodeScanner.java]

          Both parameters are always set to zero when setting a breakpoint here.
          New: I’m trying to use form validation on a dropdownDescriptorSelector, however here the validation method parameters (annotated with @QueryParameter) are not found and set to null (or 0). (If used standalone the validation works).

          Is there anything different with a dropdownDescriptorSelector? Or is this caused since the jelly views are in different plugins that use different class loaders?

          The relevant main jelly part:

          {code}
          <f:entry description="${description.tool}">
          <f:dropdownDescriptorSelector field="tool" title="${%title.tool}"
          descriptors="${descriptor.availableTools}"/>
          </f:entry>
          {code}
          (whole file: [ScanForIssuesStep/config.jelly|https://github.com/jenkinsci/analysis-core-plugin/blob/3.0/src/main/resources/io/jenkins/plugins/analysis/core/steps/ScanForIssuesStep/config.jelly])

          The relevant jelly part of the referenced Describable:
          {code}
          <f:entry title="${%High priority threshold}"
                  description="${%Minimum number of duplicated lines for high priority warnings.}"
                  field="highThreshold">
           <f:textbox default="50"/>
          </f:entry>
          {code}
          (whole file: [DuplicateCodeScanner/config.jelly|https://github.com/jenkinsci/warnings-plugin/blob/3.0/src/main/resources/io/jenkins/plugins/analysis/warnings/DuplicateCodeScanner/config.jelly])

          My validation method:
          {code}
          public FormValidation doCheckHighThreshold(@QueryParameter final int highThreshold,
                 @QueryParameter final int normalThreshold) {
             return VALIDATION.validateHigh(highThreshold, normalThreshold);
          }
          {code}
          (whole file: [DuplicateCodeScanner.java|https://github.com/jenkinsci/warnings-plugin/blob/3.0/src/main/java/io/jenkins/plugins/analysis/warnings/DuplicateCodeScanner.java])

          Both parameters are always set to zero when setting a breakpoint here.
          Jesse Glick made changes -
          Issue Type Original: Improvement [ 4 ] New: Bug [ 1 ]
          Labels New: diagnostics stapler
          Summary Original: @QueryParameter in form validation is not filled for dropdownDescriptorSelector New: @QueryParameter in form validation is not filled for dropdownDescriptorSelector when using nonpublic class

            Unassigned Unassigned
            drulli Ulli Hafner
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: