You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by pa...@apache.org on 2019/07/04 10:35:19 UTC

[sling-org-apache-sling-servlets-post] branch master updated: SLING-8560: make sure we catch all cases if jcr is not enabled.

This is an automated email from the ASF dual-hosted git repository.

pauls pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-servlets-post.git


The following commit(s) were added to refs/heads/master by this push:
     new 08fbf17  SLING-8560: make sure we catch all cases if jcr is not enabled.
08fbf17 is described below

commit 08fbf172b7dc511150ffbdecc10752ce8312deb3
Author: Karl Pauls <ka...@gmail.com>
AuthorDate: Thu Jul 4 12:35:11 2019 +0200

    SLING-8560: make sure we catch all cases if jcr is not enabled.
---
 .../org/apache/sling/servlets/post/impl/SlingPostServlet.java    | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/sling/servlets/post/impl/SlingPostServlet.java b/src/main/java/org/apache/sling/servlets/post/impl/SlingPostServlet.java
index 72aa1bf..86f607c 100644
--- a/src/main/java/org/apache/sling/servlets/post/impl/SlingPostServlet.java
+++ b/src/main/java/org/apache/sling/servlets/post/impl/SlingPostServlet.java
@@ -198,7 +198,12 @@ public class SlingPostServlet extends SlingAllMethodsServlet {
     public SlingPostServlet() {
         // the following operations require JCR:
         if ( JCRSupport.INSTANCE.jcrEnabled()) {
-            importOperation = new ImportOperation();
+            try {
+                importOperation = new ImportOperation();
+            } catch ( final Throwable t) {
+                log.warn("Support for JCR operations like checkin, checkout, import, ordering etc. is currently disabled " +
+                    "in the servlets post module. Check whether the JCR API is available.", t);
+            }
         }
     }
 
@@ -440,7 +445,7 @@ public class SlingPostServlet extends SlingAllMethodsServlet {
             SlingPostConstants.OPERATION_NOP, new NopOperation()));
 
         // the following operations require JCR:
-        if ( JCRSupport.INSTANCE.jcrEnabled()) {
+        if ( JCRSupport.INSTANCE.jcrEnabled() && importOperation != null) {
             providedServices.add(registerOperation(bundleContext,
                 SlingPostConstants.OPERATION_IMPORT, importOperation));
             providedServices.add(registerOperation(bundleContext,