From 55bf06b43d8e8ed2f15357e4ecf26eefbff31e29 Mon Sep 17 00:00:00 2001 From: Dave Borowitz Date: Mon, 26 Mar 2012 10:19:40 -0700 Subject: Allow RepositoryResolver to throw ServiceMayNotContinueException Implementations may want to send an error message to the user, which doesn't really fit with any of the existing exception types. ServiceMayNotContinueException, on the other hand, is documented as always containing a user-visible error string, so use that. Modify the git and HTTP transport mechanisms to properly relay this message to the end user. Change-Id: I362e67ea46102a145bf2c6284d38788537c9735f --- .../src/org/eclipse/jgit/http/server/RepositoryFilter.java | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'org.eclipse.jgit.http.server/src/org') diff --git a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/RepositoryFilter.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/RepositoryFilter.java index 571183682f..5b336b2f93 100644 --- a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/RepositoryFilter.java +++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/RepositoryFilter.java @@ -65,6 +65,7 @@ import javax.servlet.http.HttpServletResponse; import org.eclipse.jgit.errors.RepositoryNotFoundException; import org.eclipse.jgit.lib.Repository; +import org.eclipse.jgit.transport.ServiceMayNotContinueException; import org.eclipse.jgit.transport.resolver.RepositoryResolver; import org.eclipse.jgit.transport.resolver.ServiceNotAuthorizedException; import org.eclipse.jgit.transport.resolver.ServiceNotEnabledException; @@ -141,6 +142,9 @@ public class RepositoryFilter implements Filter { } catch (ServiceNotAuthorizedException e) { res.sendError(SC_UNAUTHORIZED); return; + } catch (ServiceMayNotContinueException e) { + sendError(req, res, SC_INTERNAL_SERVER_ERROR, e.getMessage()); + return; } try { request.setAttribute(ATTRIBUTE_REPOSITORY, db); -- cgit v1.2.3