Merge branch 'feature/SUPPORT-8725_refactor' into develop

This commit is contained in:
adel.ka 2024-12-17 16:23:40 +03:00
commit 676acf414c

View file

@ -78,13 +78,7 @@ public class FileUploadService {
try {
FileUrl fileUrl = parseFileUrl(downloadRequest.fileInfo().getFileUrl());
try {
Files.createDirectories(Paths.get(fileSavingPath));
}
catch (IOException e) {
throw new RuntimeException("Failed to create directory " + fileSavingPath, e);
}
Files.createDirectories(Paths.get(fileSavingPath));
LOGGER.info("working in {}", System.getProperty("user.home"));
Path filePath = Paths.get(fileSavingPath, fileUrl.fileName());
String downloadUrl = fileUrl.fileUrl();
@ -131,7 +125,7 @@ public class FileUploadService {
Files.delete(filePath);
}
catch (IOException e) {
throw new RuntimeException("Failed to delete file " + filePath.getFileName());
LOGGER.error("Failed to delete file " + filePath, e);
}
finally {
acknowledgment.acknowledge();
@ -146,7 +140,7 @@ public class FileUploadService {
sendMessage(inStatusTopic.name(), downloadRequest, messageId, inKafkaTemplate);
acknowledgment.acknowledge();
}
catch (FileUploadException e) {
catch (FileUploadException | IOException e) {
// считаем, что нужно повторное считывание сообщения
// ошибку логируем, сообщение оставляем непрочитанным
LOGGER.error(e.getMessage(), e);