Skip to content

Commit

Permalink
Merge pull request #7435 from kofemann/issue7434-9.2
Browse files Browse the repository at this point in the history
webdav: do not log  stacktrace if non-existing `well-known` is requested
  • Loading branch information
svemeyer authored Nov 29, 2023
2 parents 9ad93f6 + 1748b3b commit 83beb88
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 83beb88

Please sign in to comment.