Skip to content

Commit

Permalink
webdav: do not log stacktrace if non-existing well-known is requested
Browse files Browse the repository at this point in the history
No reaouns to log a stacktrace

Fixes: #7434
Acked-by: Lea Morschel
Acked-by: Albert Rossi
Target: master, 9.2
Require-book: no
Require-notes: yes
  • Loading branch information
kofemann committed Nov 21, 2023
1 parent 87f1964 commit 05d9c4c
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,10 @@ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
*/
package org.dcache.services.httpd.handlers;

import diskCacheV111.util.CacheException;
import dmg.util.HttpRequest;
import java.io.IOException;
import java.net.URISyntaxException;
import java.util.Optional;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
Expand Down Expand Up @@ -91,7 +93,8 @@ public void handle(String target, Request baseRequest,
String[] tokens = proxy.getRequestTokens();
Optional<WellKnownProducerFactory> factory = factoryProvider.getFactory(tokens[1]);
if (factory.isEmpty()) {
throw new OnErrorException("No such endpoint");
response.sendError(HttpServletResponse.SC_NOT_FOUND, "No such endpoint");
return;
}

WellKnownProducer producer = factory.get().createProducer();
Expand All @@ -108,8 +111,8 @@ public void handle(String target, Request baseRequest,
baseRequest.setHandled(true);
}

} catch (Exception t) {
throw new ServletException("WellKnownHandler", t);
} catch (CacheException | URISyntaxException e) {
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.getMessage());
}
}

Expand Down

0 comments on commit 05d9c4c

Please sign in to comment.