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

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

    Details

    • Similar Issues:

      Description

      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.

        Attachments

          Activity

          drulli Ulli Hafner created issue -
          drulli Ulli Hafner made changes -
          Field Original Value New Value
          Description ’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.
          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.
          drulli Ulli Hafner made changes -
          Description 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.
          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.
          drulli Ulli Hafner made changes -
          Description 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.
          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.
          jglick Jesse Glick made changes -
          Summary @QueryParameter in form validation is not filled for dropdownDescriptorSelector @QueryParameter in form validation is not filled for dropdownDescriptorSelector when using nonpublic class
          Issue Type Improvement [ 4 ] Bug [ 1 ]
          Labels diagnostics stapler

            People

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

              Dates

              • Created:
                Updated: