MasterBuildCause currentCause =
(MasterBuildCause) build.getCause(MasterBuildCause.class);
int rebuildNumber = currentCause.getRebuildNumber();
if (result.isWorseThan(Result.SUCCESS)
&& rebuildNumber < maxRetries) {
Cause newCause =
new MasterBuildCause(masterBuild, rebuildNumber + 1);
this.masterBuild.rebuild(project, newCause);
projectBuildMap.remove(project);
causeMap.put(project, newCause);
logger.printf("!!!REBUILDING!!! %s (%s%s%s)\n",
project.getDisplayName(),
hudson.getRootUrl(),
build.getUrl(),
page);
} else {
completed.add(project);
}
}
} else {
Cause cause = causeMap.containsKey(project)
? causeMap.get(project) : this.cause;
build = buildFinder.findBuild(project, cause);
if (build != null) {
masterBuild.addSubBuild(
project.getDisplayName(),