Skip to content
Permalink
Browse files

[JENKINS-17439] add a warning if a file still exists after it is deleted

  • Loading branch information...
Rob Petti
Rob Petti committed May 9, 2013
1 parent ae1cba7 commit 644ad886249dbd8f2356fae1d1148a429a2ee95f
Showing with 11 additions and 3 deletions.
  1. +11 −3 src/main/java/hudson/plugins/perforce/QuickCleanerCall.java
@@ -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);
@@ -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());

0 comments on commit 644ad88

Please sign in to comment.
You can’t perform that action at this time.