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

promoted-builds plugin ClassCastException with a null parameter

      (I would have commented on JENKINS-20912, but it's closed.)

      The issue raised in JENKINS-20912 was closed incorrectly. The root cause is the same as in JENKINS-13465; if you have a parameter with a null value, the JSON serializer chokes and the plugin does not properly handle the error. This appears in version 2.17 and does not appear to have been fixed in any later release.

      The steps for replication in JENKINS-20912 still work, the key is adding a string parameter and not inserting any value. However, any null parameter at all will choke the plugin (I ran into trouble with the HipChat plugin not specifying a target room by default).

          [JENKINS-27322] promoted-builds plugin ClassCastException with a null parameter

          Adam Compton added a comment -

          I should be clear; this is the issue raised by @jmellor in this comment. That issue is not related to the original ticket, but it is still valid, and would be fixed by handling the error as described above.

          Adam Compton added a comment - I should be clear; this is the issue raised by @jmellor in this comment . That issue is not related to the original ticket, but it is still valid, and would be fixed by handling the error as described above.

          Jim Patterson added a comment -

          We've run into a VERY similar issue whenever we add the Promoted Build Parameter to a job for a promotion level which hasn't been reached yet by any artifacts, attempting to run our downstream deployment job with the "empty" drop down results in the following error:
          (please note: I typed the following in from a graphical image so its possible I missed typed something)

          javax.servlet.ServletException: java.lang.IllegalArgumentException: Failed to instantiate class
          hudson.plugins.promoted_builds.parameter.PromotedBuildParameterValue from

          {"name":"BLUE_STAR_UPSTREAM","runId":""}

          at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:795)
          at org.kohsuke.stapler.Stapler.invoke(Stapler.java:875)
          at org.kohsuke.stapler.MetaClass$6.doDispatch(MetaClass.java:249)
          at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:53)
          at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:745)
          ...

          Jim Patterson added a comment - We've run into a VERY similar issue whenever we add the Promoted Build Parameter to a job for a promotion level which hasn't been reached yet by any artifacts, attempting to run our downstream deployment job with the "empty" drop down results in the following error: (please note: I typed the following in from a graphical image so its possible I missed typed something) javax.servlet.ServletException: java.lang.IllegalArgumentException: Failed to instantiate class hudson.plugins.promoted_builds.parameter.PromotedBuildParameterValue from {"name":"BLUE_STAR_UPSTREAM","runId":""} at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:795) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:875) at org.kohsuke.stapler.MetaClass$6.doDispatch(MetaClass.java:249) at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:53) at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:745) ...

          Jim Patterson added a comment -

          also this is happening on version 2.22 of the promoted-builds plugin and we are running the Commercial Cloudbees version of Jenkins

          Jenkins ver. 1.580.2.1 (Jenkins Enterprise by CloudBees 14.11)

          Jim Patterson added a comment - also this is happening on version 2.22 of the promoted-builds plugin and we are running the Commercial Cloudbees version of Jenkins Jenkins ver. 1.580.2.1 (Jenkins Enterprise by CloudBees 14.11)

          Jim Patterson added a comment -

          I was able to reproduce on another machine using the latest version of all my plugins and on this OSS version of jenkins with a fresh restart: Jenkins ver. 1.637
          and got a full stack trace in text this time around:

          javax.servlet.ServletException: java.lang.IllegalArgumentException: Failed to instantiate class hudson.plugins.promoted_builds.parameters.PromotedBuildParameterValue from

          {"name":"GOLD_STAR_UPSTREAM","runId":""}

          at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:796)
          at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876)
          at org.kohsuke.stapler.MetaClass$6.doDispatch(MetaClass.java:249)
          at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:53)
          at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746)
          at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876)
          at org.kohsuke.stapler.Stapler.invoke(Stapler.java:649)
          at org.kohsuke.stapler.Stapler.service(Stapler.java:238)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
          at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:686)
          at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1494)
          at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:132)
          at hudson.plugins.greenballs.GreenBallFilter.doFilter(GreenBallFilter.java:59)
          at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:129)
          at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:198)
          at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:176)
          at net.bull.javamelody.PluginMonitoringFilter.doFilter(PluginMonitoringFilter.java:85)
          at org.jvnet.hudson.plugins.monitoring.HudsonMonitoringFilter.doFilter(HudsonMonitoringFilter.java:99)
          at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:129)
          at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:123)
          at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1482)
          at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:49)
          at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1482)
          at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84)
          at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:76)
          at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:171)
          at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1482)
          at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:49)
          at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1482)
          at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:81)
          at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1482)
          at org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30)
          at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1474)
          at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:499)
          at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
          at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:533)
          at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
          at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086)
          at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:428)
          at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
          at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020)
          at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
          at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
          at org.eclipse.jetty.server.Server.handle(Server.java:370)
          at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:489)
          at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:960)
          at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:1021)
          at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:865)
          at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240)
          at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
          at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:668)
          at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)
          at winstone.BoundedExecutorService$1.run(BoundedExecutorService.java:77)
          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
          at java.lang.Thread.run(Thread.java:745)
          Caused by: java.lang.IllegalArgumentException: Failed to instantiate class hudson.plugins.promoted_builds.parameters.PromotedBuildParameterValue from

          {"name":"GOLD_STAR_UPSTREAM","runId":""}

          at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:602)
          at org.kohsuke.stapler.RequestImpl.bindJSON(RequestImpl.java:404)
          at org.kohsuke.stapler.RequestImpl.bindJSON(RequestImpl.java:400)
          at hudson.plugins.promoted_builds.parameters.PromotedBuildParameterDefinition.createValue(PromotedBuildParameterDefinition.java:90)
          at hudson.plugins.promoted_builds.parameters.PromotedBuildParameterDefinition.createValue(PromotedBuildParameterDefinition.java:72)
          at hudson.model.ParametersDefinitionProperty._doBuild(ParametersDefinitionProperty.java:152)
          at jenkins.model.ParameterizedJobMixIn.doBuild(ParameterizedJobMixIn.java:191)
          at hudson.model.AbstractProject.doBuild(AbstractProject.java:1752)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:606)
          at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:298)
          at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:161)
          at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:96)
          at org.kohsuke.stapler.MetaClass$1.doDispatch(MetaClass.java:121)
          at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:53)
          at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746)
          ... 55 more
          Caused by: java.lang.IllegalArgumentException:
          at hudson.model.RunParameterValue.check(RunParameterValue.java:51)
          at hudson.model.RunParameterValue.<init>(RunParameterValue.java:41)
          at hudson.plugins.promoted_builds.parameters.PromotedBuildParameterValue.<init>(PromotedBuildParameterValue.java:40)
          at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
          at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
          at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
          at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
          at org.kohsuke.stapler.RequestImpl.invokeConstructor(RequestImpl.java:451)
          at org.kohsuke.stapler.RequestImpl.instantiate(RequestImpl.java:703)
          at org.kohsuke.stapler.RequestImpl.access$200(RequestImpl.java:81)
          at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:600)
          ... 72 more

          Jim Patterson added a comment - I was able to reproduce on another machine using the latest version of all my plugins and on this OSS version of jenkins with a fresh restart: Jenkins ver. 1.637 and got a full stack trace in text this time around: javax.servlet.ServletException: java.lang.IllegalArgumentException: Failed to instantiate class hudson.plugins.promoted_builds.parameters.PromotedBuildParameterValue from {"name":"GOLD_STAR_UPSTREAM","runId":""} at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:796) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876) at org.kohsuke.stapler.MetaClass$6.doDispatch(MetaClass.java:249) at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:53) at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:649) at org.kohsuke.stapler.Stapler.service(Stapler.java:238) at javax.servlet.http.HttpServlet.service(HttpServlet.java:848) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:686) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1494) at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:132) at hudson.plugins.greenballs.GreenBallFilter.doFilter(GreenBallFilter.java:59) at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:129) at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:198) at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:176) at net.bull.javamelody.PluginMonitoringFilter.doFilter(PluginMonitoringFilter.java:85) at org.jvnet.hudson.plugins.monitoring.HudsonMonitoringFilter.doFilter(HudsonMonitoringFilter.java:99) at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:129) at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:123) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1482) at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:49) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1482) at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84) at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:76) at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:171) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1482) at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:49) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1482) at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:81) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1482) at org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1474) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:499) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137) at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:533) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:428) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116) at org.eclipse.jetty.server.Server.handle(Server.java:370) at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:489) at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:960) at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:1021) at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:865) at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240) at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82) at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:668) at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52) at winstone.BoundedExecutorService$1.run(BoundedExecutorService.java:77) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.IllegalArgumentException: Failed to instantiate class hudson.plugins.promoted_builds.parameters.PromotedBuildParameterValue from {"name":"GOLD_STAR_UPSTREAM","runId":""} at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:602) at org.kohsuke.stapler.RequestImpl.bindJSON(RequestImpl.java:404) at org.kohsuke.stapler.RequestImpl.bindJSON(RequestImpl.java:400) at hudson.plugins.promoted_builds.parameters.PromotedBuildParameterDefinition.createValue(PromotedBuildParameterDefinition.java:90) at hudson.plugins.promoted_builds.parameters.PromotedBuildParameterDefinition.createValue(PromotedBuildParameterDefinition.java:72) at hudson.model.ParametersDefinitionProperty._doBuild(ParametersDefinitionProperty.java:152) at jenkins.model.ParameterizedJobMixIn.doBuild(ParameterizedJobMixIn.java:191) at hudson.model.AbstractProject.doBuild(AbstractProject.java:1752) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:298) at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:161) at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:96) at org.kohsuke.stapler.MetaClass$1.doDispatch(MetaClass.java:121) at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:53) at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746) ... 55 more Caused by: java.lang.IllegalArgumentException: at hudson.model.RunParameterValue.check(RunParameterValue.java:51) at hudson.model.RunParameterValue.<init>(RunParameterValue.java:41) at hudson.plugins.promoted_builds.parameters.PromotedBuildParameterValue.<init>(PromotedBuildParameterValue.java:40) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:526) at org.kohsuke.stapler.RequestImpl.invokeConstructor(RequestImpl.java:451) at org.kohsuke.stapler.RequestImpl.instantiate(RequestImpl.java:703) at org.kohsuke.stapler.RequestImpl.access$200(RequestImpl.java:81) at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:600) ... 72 more

            Unassigned Unassigned
            acompton Adam Compton
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: