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

Stapler returns 200 OK instead of 500 when an internal server error happens

XMLWordPrintable

      Install Build Monitor Plugin as it will make triggering the error easier: https://wiki.jenkins-ci.org/display/JENKINS/Build+Monitor+Plugin

      To replicate the problem first make Jenkins throw a NullPointerException.
      On Jenkins 1.480 this can be easily done by triggering JENKINS-15309 (https://issues.jenkins-ci.org/browse/JENKINS-15309)

      • create a new Build Monitor view and add some jobs to it. Shut down Jenkins.
      • edit the config.xml file and make sure that instead of <jobNames class="tree-set"> you have <jobNames> (no class specified) as this will cause an unhandled NullPointerException
      • start up Jenkins and navigate to the Build Monitor view tab
      • open Google Chrome developer console, go to Network Tab and view the response returned by Jenkins to a fetchJobViews request. It will be something like the following:

      HEADERS:
      Request URL:http://localhost:8080/$stapler/bound/c9717585-a435-44f6-84fc-732ac9460461/fetchJobViews
      Request Method:POST
      Status Code:200 OK
      Request Headersview source

      BODY:
      cause: null
      localizedMessage: ""
      message: ""
      stackTrace: [

      {className:java.util.TreeSet, fileName:TreeSet.java, lineNumber:154, methodName:<init>,…}

      ,…]

      Please note the "200 OK" part. If there is an internal server error, Jenkins should never return a 200 OK, but something more appropriate such as 500.
      Returning a correct HTTP error code will make it easier for plugin developers to correctly react the the problem.

            Unassigned Unassigned
            janek Jan Molak
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: