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

NullPointerException on non-existent downstream builds

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      We experience NullPointerExceptions when Build Failure Analyzer Plugin tries to analyze failures of non-existent downstream builds.

      To reproduce this error, create a job with a downstream project (a Parameterized Trigger Plugin build step will do as well). Let the downstream project fail (for example with "Shell execute -> exit 1").

      Start the job which triggers the failing job and then delete the build of the triggered, now failed job. Browse to the overview of the trigger job and it should look something like this:

      The relevant part of the stacktrace (which is also attached) is this:

      Caused by: java.lang.NullPointerException
      	at java.util.TreeMap.compare(TreeMap.java:1188)
      	at java.util.TreeMap.put(TreeMap.java:531)
      	at java.util.TreeSet.add(TreeSet.java:255)
      	at java.util.AbstractCollection.addAll(AbstractCollection.java:334)
      	at java.util.TreeSet.addAll(TreeSet.java:312)
      	at com.sonyericsson.jenkins.plugins.bfa.model.FailureCauseBuildAction.getDownstreamBuilds(FailureCauseBuildAction.java:345)
      

      The error occurs, because the triggered downstream build is missing and therefore null in the list returned by dbf.getDownstreamBuilds(build) in the code of FailureCauseBuildAction.
      Subsequently the TreeSet.addAll() method tries to compare this null value to another entry and this results in the NullPointerException.

      I have already created a quick and dirty fix for that, where the null values are filtered out in the FailureCauseBuildAction.getDownstreamBuilds() method. But a probably better way to fix this, would be to not add the null values in CoreDBF.getDownstreamBuilds() in the first place.

      Nevertheless I will provide my fix as a pull request.

      By the way: This error is mainly caused by the fact that we discard old builds. A workaround for that would be to increase the kept builds or not throwing away the builds of downstream projects.

        Attachments

          Activity

          Show
          seder Stefan Prietl added a comment - Pull request: https://github.com/jenkinsci/build-failure-analyzer-plugin/pull/23
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Robert Sandell
          Path:
          src/main/java/com/sonyericsson/jenkins/plugins/bfa/model/FailureCauseBuildAction.java
          http://jenkins-ci.org/commit/build-failure-analyzer-plugin/39c6e9f00d3cead862d61530de694526118c1053
          Log:
          Merge pull request #23 from ederst/master

          JENKINS-24059 Fixed NullPointerException on missing downstream project

          Compare: https://github.com/jenkinsci/build-failure-analyzer-plugin/compare/36165db74950...39c6e9f00d3c

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Robert Sandell Path: src/main/java/com/sonyericsson/jenkins/plugins/bfa/model/FailureCauseBuildAction.java http://jenkins-ci.org/commit/build-failure-analyzer-plugin/39c6e9f00d3cead862d61530de694526118c1053 Log: Merge pull request #23 from ederst/master JENKINS-24059 Fixed NullPointerException on missing downstream project Compare: https://github.com/jenkinsci/build-failure-analyzer-plugin/compare/36165db74950...39c6e9f00d3c
          Hide
          rsandell rsandell added a comment -

          Version 1.10.0 (released Sep 19, 2014)

          Show
          rsandell rsandell added a comment - Version 1.10.0 (released Sep 19, 2014)

            People

            Assignee:
            t_westling Tomas Westling
            Reporter:
            seder Stefan Prietl
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: