Skip to content
Permalink
Browse files
[FIXED JENKINS-15601] Use Job.getLastUnstableBuild, which is safe for…
… 1.485+.

Also in getLastAbortedBuild, limit the number of builds searched.
  • Loading branch information
jglick committed Nov 8, 2013
1 parent 4b3f3b0 commit 40af81d203ac0a3dd8cbeefe0f544fd1edc583d5
Showing with 3 additions and 10 deletions.
  1. +3 −10 src/main/java/com/robestone/hudson/compactcolumns/AbstractStatusesColumn.java
@@ -177,15 +177,7 @@ public static BuildInfo getLastStableBuild(Job<?, ?> job, Locale locale, boolean

public static BuildInfo getLastUnstableBuild(Job<?, ?> job, Locale locale, boolean isUnstableShownOnlyIfLast,
boolean isShowColorblindUnderlineHint, boolean isFirst, TimeAgoType timeAgoType) {
Run<?, ?> lastUnstable = null;
Run<?, ?> latest = job.getLastBuild();
while (latest != null) {
if (latest.getResult() == Result.UNSTABLE) {
lastUnstable = latest;
break;
}
latest = latest.getPreviousBuild();
}
Run<?, ?> lastUnstable = job.getLastUnstableBuild();
if (lastUnstable == null) {
return null;
}
@@ -207,7 +199,8 @@ private static void addNonNull(List<BuildInfo> builds, BuildInfo info) {
}
private static Run<?, ?> getLastAbortedBuild(Job<?, ?> job) {
Run<?, ?> latest = job.getLastBuild();
while (latest != null) {
int i = 0;
while (latest != null && i++ < 20) {
if (latest.getResult() == Result.ABORTED) {
return latest;
}

0 comments on commit 40af81d

Please sign in to comment.