aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacek <jacek.poreda@sonarsource.com>2022-04-28 11:40:10 +0200
committersonartech <sonartech@sonarsource.com>2022-04-28 20:02:52 +0000
commit69dd5dc2ea6b2bd03af6c5365ef5cdcbbf34d777 (patch)
treef9c6bcfc7b17dd7864a8e65468c0fd8938af451a
parent22775e5058dc2a2ba65946967aa850d203d07588 (diff)
downloadsonarqube-69dd5dc2ea6b2bd03af6c5365ef5cdcbbf34d777.tar.gz
sonarqube-69dd5dc2ea6b2bd03af6c5365ef5cdcbbf34d777.zip
Delete files if exist in ScoreMatrixDumperImplTest
-rw-r--r--server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/filemove/ScoreMatrixDumperImplTest.java14
1 files changed, 6 insertions, 8 deletions
diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/filemove/ScoreMatrixDumperImplTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/filemove/ScoreMatrixDumperImplTest.java
index cc3da964b27..5c9e2d851bb 100644
--- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/filemove/ScoreMatrixDumperImplTest.java
+++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/filemove/ScoreMatrixDumperImplTest.java
@@ -66,15 +66,13 @@ public class ScoreMatrixDumperImplTest {
@After
public void cleanUp() {
try {
- FileUtils.listFiles(tempDir.toFile(), new AbstractFileFilter() {
- @Override
- public boolean accept(File file) {
- if (file.getName().contains("score-matrix-")) {
- file.delete();
- }
- return false;
+ Files.list(tempDir.toAbsolutePath()).filter(p -> p.getFileName().toString().contains("score-matrix-")).forEach((p) -> {
+ try {
+ Files.deleteIfExists(p);
+ } catch (Exception e) {
+ System.out.println("Could not delete file. Details: " + e.getMessage());
}
- }, null);
+ });
} catch (Exception e) {
System.out.println("Cleaning up temp directory failed. Details: " + e.getMessage());
}