Skip to content
Permalink
Browse files

[FIXED JENKINS-18804] Fixed NPE on TriggeredBuildSelector when the up…

…stream is removed.
  • Loading branch information...
ikedam committed Sep 29, 2014
1 parent 7243590 commit 0af073471b7b630e6e3b9ca8e8984fd2bf2f9afa
Showing with 12 additions and 0 deletions.
  1. +12 −0 src/main/java/hudson/plugins/copyartifact/TriggeredBuildSelector.java
@@ -23,6 +23,9 @@
*/
package hudson.plugins.copyartifact;

import java.util.logging.Level;
import java.util.logging.Logger;

import jenkins.model.Jenkins;
import hudson.EnvVars;
import hudson.Extension;
@@ -44,6 +47,7 @@
* @author Alan Harder
*/
public class TriggeredBuildSelector extends BuildSelector {
private static final Logger LOGGER = Logger.getLogger(TriggeredBuildSelector.class.getName());
/**
* Which build should be used if triggered by multiple upstream builds.
*
@@ -160,6 +164,14 @@ public boolean isUseNewest() {
} else {
// Figure out the parent job and do a recursive call to getBuild
Job<?,?> parentJob = Jenkins.getInstance().getItemByFullName(upstreamProject, Job.class);
if (parentJob == null) {
LOGGER.log(Level.WARNING, "Upstream project doesn't exist (may be removed): {0}", upstreamProject);
continue;
}
if (parentJob.getBuildByNumber(upstreamBuild) == null) {
LOGGER.log(Level.WARNING, "Upstream build doesn't exist (may be removed): {0} #{1}", new Object[]{upstreamProject, upstreamBuild});
continue;
}
Run<?,?> run = getBuild(
job,
env,

0 comments on commit 0af0734

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