From 0a0f5a4d0fe4540ebdeee7a9f917f0145941d9bd Mon Sep 17 00:00:00 2001 From: Dominik Przybyl Date: Sat, 4 Nov 2023 23:04:01 +0100 Subject: [PATCH] fixed script, history delete --- .../cognifide/apm/core/endpoints/ScriptDeleteServlet.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/aem/core/src/main/java/com/cognifide/apm/core/endpoints/ScriptDeleteServlet.java b/app/aem/core/src/main/java/com/cognifide/apm/core/endpoints/ScriptDeleteServlet.java index f2236072..d2e6ad43 100644 --- a/app/aem/core/src/main/java/com/cognifide/apm/core/endpoints/ScriptDeleteServlet.java +++ b/app/aem/core/src/main/java/com/cognifide/apm/core/endpoints/ScriptDeleteServlet.java @@ -32,6 +32,8 @@ import org.apache.sling.models.factory.ModelFactory; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Reference; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; @Component( service = Servlet.class, @@ -44,6 +46,8 @@ ) public class ScriptDeleteServlet extends SlingAllMethodsServlet { + private static final Logger LOGGER = LoggerFactory.getLogger(ScriptDeleteServlet.class); + @Reference private ModelFactory modelFactory; @@ -55,11 +59,13 @@ protected void doPost(SlingHttpServletRequest request, SlingHttpServletResponse for (String path : form.getPaths()) { if (session.nodeExists(path)) { session.removeItem(path); + LOGGER.info("Item {} successfully deleted", path); } } session.save(); return ResponseEntity.ok("Item(s) successfully deleted"); } catch (Exception e) { + LOGGER.error("Error while deleting item(s)", e); return ResponseEntity.badRequest(StringUtils.defaultString(e.getMessage(), "Errors while deleting item(s)")); } });