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

Loading the build history causes an NPE on the History Widget

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • core
    • None

      When clicking more on a project with a long history, I get the following NPE in jenkins console:

      Winstone 2011/02/03 10:13:24] - Untrapped Error in Servlet
      javax.servlet.ServletException: java.lang.NullPointerException
      	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:597)
      	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:640)
      	at org.kohsuke.stapler.MetaClass$13.dispatch(MetaClass.java:382)
      	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:562)
      	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:640)
      	at org.kohsuke.stapler.MetaClass$7.doDispatch(MetaClass.java:242)
      	at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:53)
      	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:562)
      	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:640)
      	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:478)
      	at org.kohsuke.stapler.Stapler.service(Stapler.java:160)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:45)
      	at winstone.ServletConfiguration.execute(ServletConfiguration.java:249)
      	at winstone.RequestDispatcher.forward(RequestDispatcher.java:335)
      	at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:378)
      	at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:94)
      	at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:86)
      	at winstone.FilterConfiguration.execute(FilterConfiguration.java:195)
      	at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:368)
      	at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:47)
      	at winstone.FilterConfiguration.execute(FilterConfiguration.java:195)
      	at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:368)
      	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84)
      	at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:76)
      	at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:164)
      	at winstone.FilterConfiguration.execute(FilterConfiguration.java:195)
      	at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:368)
      	at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:81)
      	at winstone.FilterConfiguration.execute(FilterConfiguration.java:195)
      	at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:368)
      	at winstone.RequestDispatcher.forward(RequestDispatcher.java:333)
      	at winstone.RequestHandlerThread.processRequest(RequestHandlerThread.java:244)
      	at winstone.RequestHandlerThread.run(RequestHandlerThread.java:150)
      	at java.lang.Thread.run(Thread.java:662)
      Caused by: java.lang.NullPointerException
      	at java.lang.String.compareTo(String.java:1167)
      	at hudson.model.Job$2.compare(Job.java:447)
      	at hudson.model.Job$2.compare(Job.java:441)
      	at hudson.widgets.HistoryWidget.doAjax(HistoryWidget.java:163)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at java.lang.reflect.Method.invoke(Method.java:597)
      	at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:282)
      	at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:149)
      	at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:88)
      	at org.kohsuke.stapler.MetaClass$1.doDispatch(MetaClass.java:102)
      	at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:53)
      	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:562)
      	... 33 more
      

      This is caused by the next scheduled call to buildHistory() which will lack the n parameter passed in the header as the loadAllBuildHistory() fails to properly keep track of the headers variable.

      I have a patch that fixes it but I would appreciate a review.

            Unassigned Unassigned
            lacostej lacostej
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: