fixed catching of exception in deleteFileSetRoutine

This commit is contained in:
Francesco Mangiacrapa 2023-04-28 16:53:30 +02:00
parent 8b92ee395b
commit a210d1e237
1 changed files with 6 additions and 5 deletions

View File

@ -1266,12 +1266,13 @@ public class ProfiledMongoManager extends MongoManager implements MongoManagerI<
// Changed by Francesco // Changed by Francesco
RegisteredFileSet fs = null; RegisteredFileSet fs = null;
error = null; error = null;
Exception theExc = null; Exception filesetExc = null;
try { try {
List<Object> deleteList = wrapper.getByPath(path); List<Object> deleteList = wrapper.getByPath(path);
if (deleteList == null || deleteList.isEmpty()) { if (deleteList == null || deleteList.isEmpty()) {
error = "List of object going to delete is null or empty"; error = "List of object going to delete is null or empty";
log.info(error); log.warn(error);
filesetExc = new ConfigurationException(error);
} }
if (error == null) { if (error == null) {
@ -1282,8 +1283,8 @@ public class ProfiledMongoManager extends MongoManager implements MongoManagerI<
} catch (Exception e) { } catch (Exception e) {
error = "Error on getting the RegisteredFileSet for path: " + path; error = "Error on getting the RegisteredFileSet for path: " + path;
log.warn(error); log.warn(error);
filesetExc = e;
log.debug("Error is: ", e); log.debug("Error is: ", e);
theExc = e;
} }
if (error != null) { if (error != null) {
@ -1291,8 +1292,8 @@ public class ProfiledMongoManager extends MongoManager implements MongoManagerI<
log.info("ignore_errors is {}, returning input doc {}", ignore_errors, doc.getId()); log.info("ignore_errors is {}, returning input doc {}", ignore_errors, doc.getId());
return doc; return doc;
} }
log.info("Thrown "+ConfigurationException.class.getSimpleName()+" with message {}", theExc.getMessage()); log.info("Thrown "+ConfigurationException.class.getSimpleName()+" with message {}", filesetExc.getMessage());
throw new ConfigurationException(theExc.getMessage()); throw new ConfigurationException(filesetExc.getMessage());
} }