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

Adding two copyartifact build steps to a project at the same time causes a JSONException

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • copyartifact-plugin, core
    • None
    • Hudson version: 1.352
      CopyArtifact Plugin Version: 1.1
      Hudson on JBOSS 4.2/Windows XP

      Steps to reproduce:

      1. Configure an existing project and add a build step to copy artifacts from another project
      2. Enter the project name to copy artifacts from
      *3. Leaving all other fields blank enter a path as the value in the "Target directory" field e.g. "cb20_cfDesignServlet\WEB-INF\lib" without the quotes
      4. Now add an additional copy artifacts build step and enter another project to copy artifacts from.
      *5. Enter the same value as previously for Target directory i.e. "cb20_cfDesignServlet\WEB-INF\lib"
      6. Click Save

      *It seems immaterial whether a Target directory is specified or not.

      The following exception is encountered:

      net.sf.json.JSONException: A JSONObject text must begin with '{' at character 1 of init
      net.sf.json.util.JSONTokener.syntaxError(JSONTokener.java:512)
      net.sf.json.JSONObject._fromJSONTokener(JSONObject.java:839)
      net.sf.json.JSONObject._fromString(JSONObject.java:1060)
      net.sf.json.JSONObject.fromObject(JSONObject.java:176)
      net.sf.json.JSONObject.fromObject(JSONObject.java:147)
      org.kohsuke.stapler.RequestImpl.getSubmittedForm(RequestImpl.java:711)
      hudson.model.Job.doConfigSubmit(Job.java:1026)
      hudson.model.AbstractProject.doConfigSubmit(AbstractProject.java:551)
      sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      java.lang.reflect.Method.invoke(Unknown Source)
      org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:169)
      org.kohsuke.stapler.Function.bindAndInvoke(Function.java:101)
      org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:54)
      org.kohsuke.stapler.MetaClass$1.doDispatch(MetaClass.java:74)
      org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:30)
      org.kohsuke.stapler.Stapler.invoke(Stapler.java:519)
      org.kohsuke.stapler.MetaClass$6.doDispatch(MetaClass.java:180)
      org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:30)
      org.kohsuke.stapler.Stapler.invoke(Stapler.java:519)
      org.kohsuke.stapler.Stapler.invoke(Stapler.java:435)
      org.kohsuke.stapler.Stapler.service(Stapler.java:123)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
      hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:94)
      hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:86)
      hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:78)
      hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84)
      hudson.security.UnwrapSecurityExceptionFilter.doFilter(UnwrapSecurityExceptionFilter.java:51)
      hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
      org.acegisecurity.ui.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:166)
      hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
      org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125)
      hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
      org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:142)
      hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
      org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:271)
      hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
      org.acegisecurity.ui.basicauth.BasicProcessingFilter.doFilter(BasicProcessingFilter.java:173)
      hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
      org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249)
      hudson.security.HttpSessionContextIntegrationFilter2.doFilter(HttpSessionContextIntegrationFilter2.java:66)
      hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
      hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:76)
      hudson.security.HudsonFilter.doFilter(HudsonFilter.java:164)
      org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

      Workaround:

      Add copy-artifact build steps one at a time.

          [JENKINS-6025] Adding two copyartifact build steps to a project at the same time causes a JSONException

          Alan Harder added a comment -

          It also seems to work fine if you first add 2 build steps, then fill in the details for both.. fails if you fill in the first one, then add the 2nd one.

          Alan Harder added a comment - It also seems to work fine if you first add 2 build steps, then fill in the details for both.. fails if you fill in the first one, then add the 2nd one.

          Alan Harder added a comment -

          Actually, not sure if that's what triggered success vs failure.. what I did notice on the failure was the pre-processing that Hudson does before form submission was skipped.

          Alan Harder added a comment - Actually, not sure if that's what triggered success vs failure.. what I did notice on the failure was the pre-processing that Hudson does before form submission was skipped.

          Code changed in hudson
          User: : mindless
          Path:
          trunk/hudson/main/war/resources/scripts/combobox.js
          trunk/www/changelog.html
          http://jenkins-ci.org/commit/29149
          Log:
          [FIXED JENKINS-6025] simplify form.onsubmit handling with combobox.
          1) in onblur handler, simply restore old form.onsubmit rather than adding
          another wrapper to call the old handler (which can result in a deep call
          stack if several comboboxes are used prior to form submission).
          2) in onsubmit handler when focused, only call the original onsubmit when
          the dropdown is not showing (ie don't call it when we intercept the submit
          to just select an item from the list and return false)
          I didn't figure out exactly why, but the current code could result in the
          original form.onsubmit handler not being called on form submission when
          multiple comboboxes are used. This simplification seems to resolve the issue.

          SCM/JIRA link daemon added a comment - Code changed in hudson User: : mindless Path: trunk/hudson/main/war/resources/scripts/combobox.js trunk/www/changelog.html http://jenkins-ci.org/commit/29149 Log: [FIXED JENKINS-6025] simplify form.onsubmit handling with combobox. 1) in onblur handler, simply restore old form.onsubmit rather than adding another wrapper to call the old handler (which can result in a deep call stack if several comboboxes are used prior to form submission). 2) in onsubmit handler when focused, only call the original onsubmit when the dropdown is not showing (ie don't call it when we intercept the submit to just select an item from the list and return false) I didn't figure out exactly why, but the current code could result in the original form.onsubmit handler not being called on form submission when multiple comboboxes are used. This simplification seems to resolve the issue.

          Alan Harder added a comment -

          This should work better now when the plugin is used with Hudson 1.353 or newer.

          Alan Harder added a comment - This should work better now when the plugin is used with Hudson 1.353 or newer.

          hand_of_henry added a comment - - edited

          Tested this in version 1.353 using the initial test case outlined above and this is still seems to be an issue.

          I verified that version 1.353 was being run.

          (also, with regards to process, should I be the person to verify the issue once fixed?)

          hand_of_henry added a comment - - edited Tested this in version 1.353 using the initial test case outlined above and this is still seems to be an issue. I verified that version 1.353 was being run. (also, with regards to process, should I be the person to verify the issue once fixed?)

          Alan Harder added a comment -

          please clear all browser caches to ensure the 1.353 javascript files are used. what browser type/version are you using, and please post any javascript errors you see.

          process: often times issue submitters don't come back to enter "verified", but yes you are welcome to do so once the issue is fixed.

          Alan Harder added a comment - please clear all browser caches to ensure the 1.353 javascript files are used. what browser type/version are you using, and please post any javascript errors you see. process: often times issue submitters don't come back to enter "verified", but yes you are welcome to do so once the issue is fixed.

          hand_of_henry added a comment -

          Yep, it was my cache. A tad embarrassing. Thanks.

          hand_of_henry added a comment - Yep, it was my cache. A tad embarrassing. Thanks.

            mindless Alan Harder
            hand_of_henry hand_of_henry
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: