SUPPORT-9156: remove throw ex

This commit is contained in:
adel.ka 2025-05-06 16:43:21 +03:00
parent 88a3460d65
commit 823eb51905

View file

@ -26,6 +26,7 @@ public class FileScanService {
private static final String KESL_SCAN = "--scan-file";
private static final int CLEAN_CODE = 0;
private static final int INFECTED_CODE = 72;
private static final int PROTECTED_CODE = 73;
private static final Logger LOGGER = LoggerFactory.getLogger(FileScanService.class);
@Value("${file.upload.directory:/tmp/uploaded_files}")
private String uploadDirectory;
@ -81,7 +82,7 @@ public class FileScanService {
LOGGER.warn("File: {} is identified as password protected. Please review the file.",
originalFileName
);
exitCode = INFECTED_CODE;
exitCode = PROTECTED_CODE;
}
return exitCode;
@ -89,12 +90,11 @@ public class FileScanService {
private boolean isPasswordProtectedFile(String result) {
if (!result.contains(passwordProtectedResultName)) {
LOGGER.warn(
"File scan result doesn't contains \"{}\"."
+ "Please check property \"password.protected.result.name\" is correct",
throw new AvException(String.format(
"File scan result doesn't contains \"%s\", "
+ "please check property \"password.protected.result.name\" is correct",
passwordProtectedResultName
);
return true;
));
}
for (String line : result.split("\n")) {