SUPPORT-8725:fix

This commit is contained in:
adel.kalimullin 2024-12-13 14:31:51 +03:00
parent 0744ca6331
commit c3ccfc9587

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 FileUploadException("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 FileUploadException("Failed to delete file " + filePath.getFileName());
LOGGER.error("Failed to delete file " + filePath.getFileName(),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);