Issue Type: Bug Bug
Assignee: Unassigned
Components: build-user-vars
Created: 02/Jun/14 11:44 AM
Description:

Precondition:

  • install rebuild plugin
  • create a Job A that triggers a Job B
  • Job A has a log rotation set to "keep 2 builds", Job B has no log rotation set
  • run Job A several times (let say 5 times)

Actual:
Job A - history: build 4 and build 5
Job B - history: build 1,2,3,4 and 5

Action:
Select Job B build 2 and run "rebuild" via "rebuild plugin"

Currently:
java.lang.NullPointerException
at org.jenkinsci.plugins.builduser.BuildUser.makeUserBuildVariables(BuildUser.java:73)
at org.jenkinsci.plugins.builduser.BuildUser.makeUserBuildVariables(BuildUser.java:77)
at org.jenkinsci.plugins.builduser.BuildUser.makeBuildVariables(BuildUser.java:64)
at hudson.model.AbstractBuild.getBuildVariables(AbstractBuild.java:984)
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)

Problem:
org.jenkinsci.plugins.builduser.BuildUser.makeUserBuildVariables(Run build, Map<String, String> variables)

// If build has been triggered form an upstream build, get UserCause from there to set user build variables
        Cause.UpstreamCause upstreamCause = (Cause.UpstreamCause) build.getCause(Cause.UpstreamCause.class);
        if (upstreamCause != null) {
            Job job = Jenkins.getInstance().getItemByFullName(upstreamCause.getUpstreamProject(), Job.class);
            Run upstream = job.getBuildByNumber(upstreamCause.getUpstreamBuild());
            makeUserBuildVariables(upstream, variables);
        }

The problem is that the upstreamCause is checked for null, but in case of logrotation (or maybe also an manual delete) has deleted the upstream-run - the variable "upstream" is not checked to null. That leads to a recursive-call where method-argument "build" is null which is also not checked.


Suggestion:
either return on "build == null"
or check Run upstream = job.getBuildByNumber(upstreamCause.getUpstreamBuild()); for null too

Environment: Plugin v1.3
Project: Jenkins
Priority: Major Major
Reporter: Sven Appenrodt
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira

--
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to