diff options
author | Jacek <jacek.poreda@sonarsource.com> | 2022-04-28 11:40:10 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2022-04-28 20:02:52 +0000 |
commit | 69dd5dc2ea6b2bd03af6c5365ef5cdcbbf34d777 (patch) | |
tree | f9c6bcfc7b17dd7864a8e65468c0fd8938af451a | |
parent | 22775e5058dc2a2ba65946967aa850d203d07588 (diff) | |
download | sonarqube-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.java | 14 |
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()); } |