Skip to content

[JENKINS-8660] Loading the build history causes an NPE on the History Widget #15587

Closed

Description

@jenkins-infra-bot

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.


Originally reported by lacostej, imported from: Loading the build history causes an NPE on the History Widget
  • status: Resolved
  • priority: Minor
  • component(s): core
  • resolution: Fixed
  • resolved: 2011-02-05T05:16:56+00:00
  • votes: 0
  • watchers: 0
  • imported: 2025-11-24
Raw content of original issue

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.

Activity

  1. jenkins-infra-bot commented on Feb 3, 2011

    @jenkins-infra-bot
    Author
    lacostej:

    Here's the patch. lacostej@3ddb68f

  2. jenkins-infra-bot commented on Feb 5, 2011

    @jenkins-infra-bot
    Author
    scm_issue_link:

    Code changed in jenkins
    User: Kohsuke Kawaguchi
    Path:
    core/src/main/java/hudson/widgets/HistoryWidget.java
    core/src/main/resources/hudson/widgets/HistoryWidget/index.jelly
    war/src/main/webapp/scripts/hudson-behavior.js
    http://jenkins-ci.org/commit/core/691f23051989f85284a7c7739478e21af4ff5716
    Log:
    Merge branch 'JENKINS-8660'

    • JENKINS-8660:
      fail more gracefully if the header is not provided.
      JENKINS-8660: loading the build history cause an NPE on the History Widget
  3. jenkins-infra-bot commented on Feb 5, 2011

    @jenkins-infra-bot
    Author
    scm_issue_link:

    Code changed in jenkins
    User: Kohsuke Kawaguchi
    Path:
    changelog.html
    core/src/main/java/hudson/widgets/HistoryWidget.java
    http://jenkins-ci.org/commit/core/6c521259e2b1061c105cb09724e4c29e8bc07ecd
    Log:
    [FIXED JENKINS-8660] recording the fix from Jerome Lacoste.

  4. jenkins-infra-bot commented on Feb 8, 2011

    @jenkins-infra-bot
    Author
    scm_issue_link:
    • Original comment link
    • Raw content of original comment:

      Code changed in jenkins User: Jerome Lacoste Path: core/src/main/java/hudson/widgets/HistoryWidget.java core/src/main/resources/hudson/widgets/HistoryWidget/index.jelly war/src/main/webapp/scripts/hudson-behavior.js http://jenkins-ci.org/commit/core/3ddb68f038dabaa703583b6468bb3b22e3c808aa Log: JENKINS-8660: loading the build history cause an NPE on the History Widget

      loadAllBuildHistory() fails to set the headers field on the replacement buildHistory DOM element.

      The patch fixes the problem by recreating a headers field. It also:

      • slightly refactor the loadAllBuildHistory() method for readability
      • add a FIXME note that the server side history widget should fail if the n parameter is missing.
      • add a pre-condition check to the buildHistory() update to catch potential bugs (note that the logging is disabled as Yahoo.log doesn't appear available)

    Code changed in jenkins
    User: Jerome Lacoste
    Path:
    core/src/main/java/hudson/widgets/HistoryWidget.java
    core/src/main/resources/hudson/widgets/HistoryWidget/index.jelly
    war/src/main/webapp/scripts/hudson-behavior.js
    http://jenkins-ci.org/commit/core/3ddb68f038dabaa703583b6468bb3b22e3c808aa
    Log:
    JENKINS-8660: loading the build history cause an NPE on the History Widget

    loadAllBuildHistory() fails to set the headers field on the replacement buildHistory DOM element.

    The patch fixes the problem by recreating a headers field.
    It also:

    • slightly refactor the loadAllBuildHistory() method for readability
    • add a FIXME note that the server side history widget should fail if the n parameter is missing.
    • add a pre-condition check to the buildHistory() update to catch potential bugs (note that the logging is disabled as Yahoo.log doesn't appear available)
  5. jenkins-infra-bot commented on Feb 8, 2011

    @jenkins-infra-bot
    Author
    scm_issue_link:
    • Original comment link
    • Raw content of original comment:

      Code changed in jenkins User: Jerome Lacoste Path: core/src/main/java/hudson/widgets/HistoryWidget.java core/src/main/resources/hudson/widgets/HistoryWidget/index.jelly war/src/main/webapp/scripts/hudson-behavior.js http://jenkins-ci.org/commit/core/9a13990be96a4048d0c27537e473d4af4971a863 Log: JENKINS-8660: loading the build history cause an NPE on the History Widget

      loadAllBuildHistory() fails to set the headers field on the replacement buildHistory DOM element.

      The patch fixes the problem by recreating a headers field. It also:

      • slightly refactor the loadAllBuildHistory() method for readability
      • add a FIXME note that the server side history widget should fail if the n parameter is missing.
      • add a pre-condition check to the buildHistory() update to catch potential bugs (note that the logging is disabled as Yahoo.log doesn't appear available)

    Code changed in jenkins
    User: Jerome Lacoste
    Path:
    core/src/main/java/hudson/widgets/HistoryWidget.java
    core/src/main/resources/hudson/widgets/HistoryWidget/index.jelly
    war/src/main/webapp/scripts/hudson-behavior.js
    http://jenkins-ci.org/commit/core/9a13990be96a4048d0c27537e473d4af4971a863
    Log:
    JENKINS-8660: loading the build history cause an NPE on the History Widget

    loadAllBuildHistory() fails to set the headers field on the replacement buildHistory DOM element.

    The patch fixes the problem by recreating a headers field.
    It also:

    • slightly refactor the loadAllBuildHistory() method for readability
    • add a FIXME note that the server side history widget should fail if the n parameter is missing.
    • add a pre-condition check to the buildHistory() update to catch potential bugs (note that the logging is disabled as Yahoo.log doesn't appear available)
  6. removed
    bugFor changelog: Minor bug. Will be listed after features
    on Nov 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions