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

NullPointerException on non-existent downstream builds

XMLWordPrintable

      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.

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

              Created:
              Updated:
              Resolved: