Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[JENKINS-17439] add a warning if a file still exists after it is deleted
  • Loading branch information
Rob Petti committed May 9, 2013
1 parent ae1cba7 commit 644ad88
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/main/java/hudson/plugins/perforce/QuickCleanerCall.java
Expand Up @@ -188,12 +188,16 @@ public void run() {
String filename = line.replace("- file(s) not on client.", "").trim();
File file = new File(workDir, filename);
if (!safelyDelete(file)) {
log("Error deleting file: " + filename);
log("WARNING: Problem deleting file during quick clean: " + filename);
}
}
}
} catch (IOException e) {
// TODO: Handle IO errors
try {
log("Exception occurred while cleaning files: " + e.getMessage());
} catch (IOException ignored) {
// can't do anything about this
}
} finally {
IOUtils.closeQuietly(in);
IOUtils.closeQuietly(log);
Expand All @@ -206,7 +210,11 @@ private boolean safelyDelete(File file) throws IOException {
while ((testPath = testPath.getParentFile()) != null) {
if (testPath.equals(parent)) {
Util.deleteFile(file);
return true;
if(!file.exists()) {
return true;
} else {
return false;
}
}
}
log("Warning, file outside workspace not cleaned: " + file.getPath());
Expand Down

0 comments on commit 644ad88

Please sign in to comment.