[ 
https://issues.apache.org/jira/browse/SLING-11038?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17879930#comment-17879930
 ] 

Joerg Hoh edited comment on SLING-11038 at 9/6/24 5:24 PM:
-----------------------------------------------------------

Redundant, as in 2.4.4 more code has been converted not to throw a 
PersistenceException anymore (SLING-10087). Also including the {{doRun}} call 
into the {{try-catch}} clause does not change any behavior. 

Thus marking it as duplicate.


was (Author: joerghoh):
Mostly redundant, as in 2.4.4 more code has been converted not to throw a 
PersistenceException anymore (SLING-10087). Also including the {{doRun}} call 
into the {{try-catch}} clause does not change any behavior. 

Thus marking it as duplicate.

> Change statuscode in SlingPostServlet for PersistenceException, take 2
> ----------------------------------------------------------------------
>
>                 Key: SLING-11038
>                 URL: https://issues.apache.org/jira/browse/SLING-11038
>             Project: Sling
>          Issue Type: Improvement
>          Components: Servlets
>    Affects Versions: Servlets Post 2.3.36
>            Reporter: Thomas Mueller
>            Assignee: Robert Munteanu
>            Priority: Major
>
> When the SlingPostServlet receives a PersistenceExceptions (e.g. when trying 
> to POST to a read-only resource), Resource at '...' is not modifiable, then a 
> 500 is returned
> This is similar to SLING-9896, but has a different code path.
> Example stacktrace:
> {noformat}
> 03.01.2022 10:45:54.476 *ERROR* [179.60.150.135 [1641206754473] POST 
> /content/dpc/inpro-seal//it/search.html HTTP/1.1] 
> org.apache.sling.servlets.post.impl.operations.ModifyOperation Exception 
> during response processing.
> org.apache.sling.api.resource.PersistenceException: Resource at 
> '/content/dpc/inpro-seal/it/search' is not modifiable.
>       at 
> org.apache.sling.servlets.post.impl.helper.SlingPropertyValueHandler.setProperty(SlingPropertyValueHandler.java:114)
>  [org.apache.sling.servlets.post:2.4.2]
>       at 
> org.apache.sling.servlets.post.impl.operations.ModifyOperation.writeContent(ModifyOperation.java:372)
>  [org.apache.sling.servlets.post:2.4.2]
>       at 
> org.apache.sling.servlets.post.impl.operations.ModifyOperation.doRun(ModifyOperation.java:93)
>  [org.apache.sling.servlets.post:2.4.2]
>       at 
> org.apache.sling.servlets.post.impl.operations.AbstractPostOperation.run(AbstractPostOperation.java:105)
>  [org.apache.sling.servlets.post:2.4.2]
>       at 
> org.apache.sling.servlets.post.impl.SlingPostServlet.doPost(SlingPostServlet.java:243)
>  [org.apache.sling.servlets.post:2.4.2]
>       at 
> org.apache.sling.api.servlets.SlingAllMethodsServlet.mayService(SlingAllMethodsServlet.java:146)
>  [org.apache.sling.api:2.22.0]
>       at 
> org.apache.sling.api.servlets.SlingSafeMethodsServlet.service(SlingSafeMethodsServlet.java:342)
>  [org.apache.sling.api:2.22.0]
>       at 
> org.apache.sling.api.servlets.SlingSafeMethodsServlet.service(SlingSafeMethodsServlet.java:374)
>  [org.apache.sling.api:2.22.0]
>       at 
> org.apache.sling.engine.impl.request.RequestData.service(RequestData.java:552)
>  [org.apache.sling.engine:2.7.2]
>       at 
> org.apache.sling.engine.impl.filter.SlingComponentFilterChain.render(SlingComponentFilterChain.java:44)
>  [org.apache.sling.engine:2.7.2]
> {noformat}
> The problem is in
> https://github.com/apache/sling-org-apache-sling-servlets-post/blob/org.apache.sling.servlets.post-2.4.2/src/main/java/org/apache/sling/servlets/post/impl/operations/AbstractPostOperation.java#L105
> {noformat}
> public void run(final SlingHttpServletRequest request,
>                     final PostResponse response,
>                     final SlingPostProcessor[] processors) throws 
> PreconditionViolatedPersistenceException, TemporaryPersistenceException {
>         final VersioningConfiguration versionableConfiguration = 
> getVersioningConfiguration(request);
>         try {
>             ...
>             doRun(request, response, changes); <<== here
>             ...
>         } catch (Exception e) {
>             log.error("Exception during response processing.", e);
>             response.setError(e);
>         } finally {
> ...
>         }
>     }
> {noformat}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to