Fix some sonar finings (2) (#1653)

Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
This commit is contained in:
Avgustin Marinov
2024-02-19 14:45:21 +02:00
committed by GitHub
parent 92de2d573c
commit 1845f9879f
2 changed files with 12 additions and 5 deletions

View File

@@ -30,6 +30,7 @@ import org.springframework.util.StringUtils;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.security.KeyManagementException;
import java.security.KeyStoreException;
@@ -171,10 +172,12 @@ public interface UpdateHandler {
*/
protected void cleanup() {
downloads.values().forEach(path -> {
if (!path.toFile().delete()) {
try {
Files.delete(path);
} catch (final IOException e) {
log.warn(LOG_PREFIX + "Failed to cleanup {}",
ddiController.getTenantId(), ddiController.getControllerId(),
path.toFile().getAbsolutePath());
path.toFile().getAbsolutePath(), e);
}
});
log.debug(LOG_PREFIX + "Cleaned up", ddiController.getTenantId(), ddiController.getControllerId());