This is an automated email from the ASF dual-hosted git repository.
cziegeler pushed a commit to branch master
in repository
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-engine.git
The following commit(s) were added to refs/heads/master by this push:
new b480456 SLING-12152 : IOException is not properly handled by error
handling
b480456 is described below
commit b48045687c47c4e0bbc72dec0705a3aa11dca997
Author: Carsten Ziegeler <[email protected]>
AuthorDate: Tue Nov 14 19:41:22 2023 +0100
SLING-12152 : IOException is not properly handled by error handling
---
.../org/apache/sling/engine/impl/SlingRequestProcessorImpl.java | 6 ++++++
1 file changed, 6 insertions(+)
diff --git
a/src/main/java/org/apache/sling/engine/impl/SlingRequestProcessorImpl.java
b/src/main/java/org/apache/sling/engine/impl/SlingRequestProcessorImpl.java
index b81ba9c..4f5c6b4 100644
--- a/src/main/java/org/apache/sling/engine/impl/SlingRequestProcessorImpl.java
+++ b/src/main/java/org/apache/sling/engine/impl/SlingRequestProcessorImpl.java
@@ -20,6 +20,7 @@ package org.apache.sling.engine.impl;
import static org.apache.sling.api.SlingConstants.ERROR_SERVLET_NAME;
+import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
@@ -264,6 +265,11 @@ public class SlingRequestProcessorImpl implements
SlingRequestProcessor {
handleError(HttpServletResponse.SC_FORBIDDEN, null, request,
response);
+ } catch (final FileNotFoundException fnfe) {
+ // send this exception as a 404 status
+ log.debug("service: File not found: {}", fnfe.getMessage());
+ handleError(HttpServletResponse.SC_NOT_FOUND, fnfe.getMessage(),
request, response);
+
} catch (final IOException ioe) {
// unwrap any causes (Jetty wraps SocketException in EofException)
Throwable cause = ioe;