Skip to content
Permalink
Browse files
Merge pull request #2263 from pjanouse/JENKINS-34228
[JENKINS-34228] Fixed IOException in DeleteBuildsCommand class
  • Loading branch information
daniel-beck committed Apr 22, 2016
2 parents e1dc525 + efc1285 commit ce9de5a19dceb82aea49787c4401e9886c21e09a
Showing with 10 additions and 3 deletions.
  1. +10 −3 core/src/main/java/hudson/cli/DeleteBuildsCommand.java
@@ -29,6 +29,7 @@

import java.io.IOException;
import java.io.PrintStream;
import java.util.HashSet;
import java.util.List;

/**
@@ -54,10 +55,16 @@ protected void printUsageSummary(PrintStream stderr) {
protected int act(List<AbstractBuild<?, ?>> builds) throws IOException {
job.checkPermission(Run.DELETE);

for (AbstractBuild build : builds)
build.delete();
final HashSet<Integer> hsBuilds = new HashSet<Integer>();

stdout.println("Deleted "+builds.size()+" builds");
for (AbstractBuild build : builds) {
if (!hsBuilds.contains(build.number)) {
build.delete();
hsBuilds.add(build.number);
}
}

stdout.println("Deleted "+hsBuilds.size()+" builds");

return 0;
}

0 comments on commit ce9de5a

Please sign in to comment.