aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.http.server/src/org
diff options
context:
space:
mode:
authorDave Borowitz <dborowitz@google.com>2012-03-26 10:19:40 -0700
committerDave Borowitz <dborowitz@google.com>2012-03-26 10:19:40 -0700
commit55bf06b43d8e8ed2f15357e4ecf26eefbff31e29 (patch)
treebda3b6c955c3fc3bc68c2dadce098a1a2f20a53b /org.eclipse.jgit.http.server/src/org
parentd794a4fde3a712d275644c58b21323807845a7fb (diff)
downloadjgit-55bf06b43d8e8ed2f15357e4ecf26eefbff31e29.tar.gz
jgit-55bf06b43d8e8ed2f15357e4ecf26eefbff31e29.zip
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
Diffstat (limited to 'org.eclipse.jgit.http.server/src/org')
-rw-r--r--org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/RepositoryFilter.java4
1 files changed, 4 insertions, 0 deletions
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);