Source:
<code>public Run<?,?> getBuild(Job<?,?> job, EnvVars env, BuildFilter filter, Run<?,?> parent) { Run<?,?> result = null; List<String> jobNames = new ArrayList<String>(); jobNames.add(job.getFullName()); if ((job instanceof AbstractProject<?,?>) && ((AbstractProject<?,?>)job).getRootProject() != job) { jobNames.add(((AbstractProject<?,?>)job).getRootProject().getFullName()); } List<Run<?, ?>> upstreamBuilds = new ArrayList<Run<?, ?>>(); for (Cause cause: parent.getCauses()) { if (cause instanceof UpstreamCause) { UpstreamCause upstream = (UpstreamCause) cause; Run<?, ?> upstreamRun = upstream.getUpstreamRun(); if (upstreamRun != null) { upstreamBuilds.add(upstreamRun); } } } if (isAllowUpstreamDependencies() && (parent instanceof AbstractBuild)) { AbstractBuild<?, ?> parentBuild = (AbstractBuild<?,?>)parent; Map<AbstractProject, Integer> parentUpstreamBuilds = parentBuild.getUpstreamBuilds(); <START> for (AbstractProject project : parentUpstreamBuilds.keySet()) { <END> upstreamBuilds.add(project.getBuildByNumber(parentUpstreamBuilds.get(project))); } } for (Run<?, ?> upstreamBuild : upstreamBuilds) { Run<?,?> run = null; if (jobNames.contains(upstreamBuild.getParent().getFullName())) { run = job.getBuildByNumber(upstreamBuild.getNumber()); } else { run = getBuild(job, env, filter, upstreamBuild); } if (run != null && filter.isSelectable(run, env)){ if ( (result == null) || (isUseNewest() && result.getNumber() < run.getNumber()) || (!isUseNewest() && result.getNumber() > run.getNumber()) ) { result = run; } } } if (result == null && isFallbackToLastSuccessful()) { result = super.getBuild(job, env, filter, parent); } return result; }</code><technical_language>Please Map#enteySet. findbugs warnings. Run mvn findbugs:findbugs compiling codes</technical_language>

Target:
public Run<?,?> getBuild(Job<?,?> job, EnvVars env, BuildFilter filter, Run<?,?> parent) { Run<?,?> result = null; List<String> jobNames = new ArrayList<String>(); jobNames.add(job.getFullName()); if ((job instanceof AbstractProject<?,?>) && ((AbstractProject<?,?>)job).getRootProject() != job) { jobNames.add(((AbstractProject<?,?>)job).getRootProject().getFullName()); } List<Run<?, ?>> upstreamBuilds = new ArrayList<Run<?, ?>>(); for (Cause cause: parent.getCauses()) { if (cause instanceof UpstreamCause) { UpstreamCause upstream = (UpstreamCause) cause; Run<?, ?> upstreamRun = upstream.getUpstreamRun(); if (upstreamRun != null) { upstreamBuilds.add(upstreamRun); } } } if (isAllowUpstreamDependencies() && (parent instanceof AbstractBuild)) { AbstractBuild<?, ?> parentBuild = (AbstractBuild<?,?>)parent; Map<AbstractProject, Integer> parentUpstreamBuilds = parentBuild.getUpstreamBuilds(); for (Map.Entry<AbstractProject, Integer> buildEntry : parentUpstreamBuilds.entrySet()) { upstreamBuilds.add(buildEntry.getKey().getBuildByNumber(buildEntry.getValue())); } } for (Run<?, ?> upstreamBuild : upstreamBuilds) { Run<?,?> run = null; if (jobNames.contains(upstreamBuild.getParent().getFullName())) { run = job.getBuildByNumber(upstreamBuild.getNumber()); } else { run = getBuild(job, env, filter, upstreamBuild); } if (run != null && filter.isSelectable(run, env)){ if ( (result == null) || (isUseNewest() && result.getNumber() < run.getNumber()) || (!isUseNewest() && result.getNumber() > run.getNumber()) ) { result = run; } } } if (result == null && isFallbackToLastSuccessful()) { result = super.getBuild(job, env, filter, parent); } return result; }