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

Field validation does not pass required query parameters when some fields are specified in a nested Describable

XMLWordPrintable

      The collabnet plugin was updated/modernized a couple years ago to include code like the following:

      CNDocumentUploader.java DescriptorImpl

      /**
        * Form validation for upload path.
        */
      public FormValidation doCheckUploadPath(CollabNetApp app, @QueryParameter String project, @QueryParameter String value)
      

      CollabNetApp.java

          public static CollabNetApp fromStapler(@QueryParameter boolean overrideAuth, @QueryParameter String url,
                                                 @QueryParameter String username, @QueryParameter String password) 
      

      config.jelly

        <f:property field="connectionFactory" />
      ...
        <f:entry title="Upload Folder Path" field="uploadPath">
          <f:textbox />
        </f:entry>
      

      ConnectionFactory has url, username, and password properties

      The generated field validation javascript then uses the 'nearBy' function when passing query parameters to the checkUploadPath backend in order to find values of url, username, and password. However uploadPath has a parent element with name 'publisher', while the direct parent of url, username, and password is a div has name 'connectionFactory'. 'publisher' is then a grandparent of url, username, and password and because of this, the needed query parameters are not included.

      One might argue that the collabnet plugin should avoid this design, since it does not work, but the changes came from Kohsuke, so attempting find a fix which preserves the current design.

      A patch to the findNearBy function in hudson-behavior.js is attached.

            jmcnally John McNally
            jmcnally John McNally
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: