rombert commented on a change in pull request #6:
URL: 
https://github.com/apache/sling-org-apache-sling-servlets-post/pull/6#discussion_r534228010



##########
File path: 
src/main/java/org/apache/sling/servlets/post/impl/SlingPostServlet.java
##########
@@ -234,6 +242,14 @@ protected void doPost(final SlingHttpServletRequest 
request,
             } catch (ResourceNotFoundException rnfe) {
                 htmlResponse.setStatus(HttpServletResponse.SC_NOT_FOUND,
                     rnfe.getMessage());
+            } catch (final PersistenceException pe) {
+                log.warn("PersistenceException while handling POST "
+                  + request.getResource().getPath() + " with "
+                  + operation.getClass().getName(), pe);
+                if (backwardsCompatibleStatuscode) {
+                  htmlResponse.setError(pe);
+                }
+                
htmlResponse.setStatus(HttpServletResponse.SC_METHOD_NOT_ALLOWED,"invalid POST 
request");

Review comment:
       Nitpick: upper-case I

##########
File path: 
src/main/java/org/apache/sling/servlets/post/impl/SlingPostServlet.java
##########
@@ -234,6 +242,14 @@ protected void doPost(final SlingHttpServletRequest 
request,
             } catch (ResourceNotFoundException rnfe) {
                 htmlResponse.setStatus(HttpServletResponse.SC_NOT_FOUND,
                     rnfe.getMessage());
+            } catch (final PersistenceException pe) {
+                log.warn("PersistenceException while handling POST "

Review comment:
       This could be using placeholders

##########
File path: 
src/main/java/org/apache/sling/servlets/post/impl/SlingPostServlet.java
##########
@@ -151,6 +152,11 @@
                             "content to the repository. By default this is 
\"j_.*\" thus ignoring all "+
                             "request parameters starting with j_ such as 
j_username.")
         String servlet_post_ignorePattern() default "j_.*";
+
+        @AttributeDefinition(name="Backwards compatible statuscode",
+                    description="In backwards compatibility mode exceptions 
will always create a statuscode "
+                        + "500 (see SLING-9896)")
+        boolean backwards_compatible_statuscode() default false;

Review comment:
       I would reformulate it as 'legacy_statuscode_on_persistence_exception`; 
maybe we would make multiple changes that that need backwards compatibility in 
the status code.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to