From a210d1e237614f878da08f28e482e721d891a96b Mon Sep 17 00:00:00 2001 From: "francesco.mangiacrapa" Date: Fri, 28 Apr 2023 16:53:30 +0200 Subject: [PATCH] fixed catching of exception in deleteFileSetRoutine --- .../service/engine/mongo/ProfiledMongoManager.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/geoportal-service/src/main/java/org/gcube/application/geoportal/service/engine/mongo/ProfiledMongoManager.java b/geoportal-service/src/main/java/org/gcube/application/geoportal/service/engine/mongo/ProfiledMongoManager.java index 1d72325..85a9895 100644 --- a/geoportal-service/src/main/java/org/gcube/application/geoportal/service/engine/mongo/ProfiledMongoManager.java +++ b/geoportal-service/src/main/java/org/gcube/application/geoportal/service/engine/mongo/ProfiledMongoManager.java @@ -1266,12 +1266,13 @@ public class ProfiledMongoManager extends MongoManager implements MongoManagerI< // Changed by Francesco RegisteredFileSet fs = null; error = null; - Exception theExc = null; + Exception filesetExc = null; try { List deleteList = wrapper.getByPath(path); if (deleteList == null || deleteList.isEmpty()) { error = "List of object going to delete is null or empty"; - log.info(error); + log.warn(error); + filesetExc = new ConfigurationException(error); } if (error == null) { @@ -1282,8 +1283,8 @@ public class ProfiledMongoManager extends MongoManager implements MongoManagerI< } catch (Exception e) { error = "Error on getting the RegisteredFileSet for path: " + path; log.warn(error); + filesetExc = e; log.debug("Error is: ", e); - theExc = e; } 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()); return doc; } - log.info("Thrown "+ConfigurationException.class.getSimpleName()+" with message {}", theExc.getMessage()); - throw new ConfigurationException(theExc.getMessage()); + log.info("Thrown "+ConfigurationException.class.getSimpleName()+" with message {}", filesetExc.getMessage()); + throw new ConfigurationException(filesetExc.getMessage()); }