Fix counter which is not updated in the loop
@@ -553,8 +553,7 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A
* @return null if no such build exists.
*/
public final R getSomeBuildWithWorkspace() {
- int cnt=0;
- for (R b = getLastBuild(); cnt<5 && b!=null; b=b.getPreviousBuild()) {
+ for (R b = getLastBuild(); b!=null; b=b.getPreviousBuild()) {
FilePath ws = b.getWorkspace();
if (ws!=null) return b;
}
@@ -562,8 +561,7 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A
}
private R getSomeBuildWithExistingWorkspace() throws IOException, InterruptedException {
- int cnt=0;
- for (R b = getLastBuild(); cnt<5 && b!=null; b=b.getPreviousBuild()) {
+ for (R b = getLastBuild(); b!=null; b=b.getPreviousBuild()) {
FilePath ws = b.getWorkspace();
if (ws!=null && ws.exists()) return b;
}
