Skip to content

Commit 982b9cd

Browse files
committed
Don't stop clean up when a file cannot be removed
WE have handled only IOException, but when a file cannot be removed due to insufficient permissions then SecurityException is raised and because of that we didn't continue with the removal of other directories. Bug-Url: https://bugzilla.redhat.com/2151549 Signed-off-by: Martin Perina <[email protected]>
1 parent d9e3e93 commit 982b9cd

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/AnsibleRunnerCleanUpService.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package org.ovirt.engine.core.bll.validator;
22

33
import java.io.File;
4-
import java.io.IOException;
54
import java.nio.file.Files;
65
import java.nio.file.Path;
76
import java.nio.file.Paths;
@@ -56,7 +55,7 @@ private void checkExecutionTimeStamp() {
5655
creationInDays = Files.readAttributes(file.toPath(), BasicFileAttributes.class)
5756
.creationTime()
5857
.to(TimeUnit.DAYS);
59-
} catch (IOException e) {
58+
} catch (Exception e) {
6059
log.error("Failed to read file '{}' attributes: {}", file.getAbsolutePath(), e.getMessage());
6160
log.debug("Exception: ", e);
6261
return;
@@ -75,7 +74,7 @@ private void checkExecutionTimeStamp() {
7574
.sorted(Comparator.reverseOrder())
7675
.map(Path::toFile)
7776
.forEach(File::delete);
78-
} catch (IOException e) {
77+
} catch (Exception e) {
7978
log.error("Failed to delete dir '{}' content: {}", file.getAbsolutePath(), e.getMessage());
8079
log.debug("Exception: ", e);
8180
}

0 commit comments

Comments
 (0)