Skip to content
Permalink
Browse files

[FIXED JENKINS-24161] Break recursion in UpstreamCause.onLoad.

  • Loading branch information
jglick committed Aug 7, 2014
1 parent b55f5eb commit 479dfb404677772a26eecc21d9f82af9e8ce71c2
Showing with 13 additions and 8 deletions.
  1. +3 −0 changelog.html
  2. +10 −8 core/src/main/java/hudson/model/Cause.java
@@ -67,6 +67,9 @@
<li class="bug">
Improving security of <code>set-build-parameter</code> and <code>set-build-result</code> CLI commands.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-24080">issue 24080</a>)
<li class="bug">
Startup can be broken by deeply recursive causes in build records.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-24161">issue 24161</a>)
<li class="rfe">
Added support for host:port format in X-Forwarded-Host header.
(<a href="https://github.com/jenkinsci/jenkins/commit/19d8b80bb2f33e4877c7170bcca8bfa318ebe77d">commit 19d8b80</a>)
@@ -98,6 +98,13 @@ public void onLoad(@Nonnull Run<?,?> build) {
}
}

void onLoad(@Nonnull Job<?,?> job, int buildNumber) {
Run<?,?> build = job.getBuildByNumber(buildNumber);
if (build != null) {
onLoad(build);
}
}

@Deprecated
public void onLoad(AbstractBuild<?,?> build) {
if (Util.isOverridden(Cause.class, getClass(), "onLoad", Run.class)) {
@@ -178,22 +185,16 @@ private UpstreamCause(String upstreamProject, int upstreamBuild, String upstream
}

@Override
public void onLoad(@Nonnull Run run) {
public void onLoad(@Nonnull Job<?,?> _job, int _buildNumber) {
Item i = Jenkins.getInstance().getItemByFullName(this.upstreamProject);
if (i == null || !(i instanceof Job)) {
// cannot initialize upstream causes
return;
}

Job j = (Job)i;
Run r = j.getBuildByNumber(this.getUpstreamBuild());
if (r == null) {
// build doesn't exist anymore
return;
}

for (Cause c : this.upstreamCauses) {
c.onLoad(r);
c.onLoad(j, upstreamBuild);
}
}

@@ -349,6 +350,7 @@ private void print(TaskListener listener, int depth) {
@Override public String toString() {
return "JENKINS-14814";
}
@Override public void onLoad(@Nonnull Job<?,?> _job, int _buildNumber) {}
}

}

0 comments on commit 479dfb4

Please sign in to comment.
You can’t perform that action at this time.