diff options
author | Masaya Suzuki <masayasuzuki@google.com> | 2019-11-08 14:30:29 -0800 |
---|---|---|
committer | Masaya Suzuki <masayasuzuki@google.com> | 2019-12-02 12:11:40 -0800 |
commit | d72d6a6b4b06ba98a9f50e37dcddce9eb70c7ef1 (patch) | |
tree | f003262140a2c9a84ef51c1b04907c4001b63568 /org.eclipse.jgit.http.server | |
parent | 2d4196b966a1f55f5c97dfd0682a29cd882acc66 (diff) | |
download | jgit-d72d6a6b4b06ba98a9f50e37dcddce9eb70c7ef1.tar.gz jgit-d72d6a6b4b06ba98a9f50e37dcddce9eb70c7ef1.zip |
UploadPackServlet: Use uploadWithExceptionPropagation
As UploadPackErrorHandler's Javadoc says, UploadPackServlet should have
called uploadWithExceptionPropagation and let UploadPackErrorHandler to
handle the exception. Fix UploadPackServlet.
Change-Id: I1f9686495fcf3ef28598ccdff3e6f76a16c8bca3
Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>
Diffstat (limited to 'org.eclipse.jgit.http.server')
-rw-r--r-- | org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/UploadPackServlet.java | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/UploadPackServlet.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/UploadPackServlet.java index 54561e0cfc..6baab5ddd7 100644 --- a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/UploadPackServlet.java +++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/UploadPackServlet.java @@ -70,7 +70,9 @@ import javax.servlet.ServletResponse; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; + import org.eclipse.jgit.annotations.Nullable; +import org.eclipse.jgit.errors.PackProtocolException; import org.eclipse.jgit.http.server.UploadPackErrorHandler.UploadPackRunnable; import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.transport.InternalHttpServerGlue; @@ -212,7 +214,8 @@ class UploadPackServlet extends HttpServlet { rsp.setContentType(UPLOAD_PACK_RESULT_TYPE); try { - up.upload(getInputStream(req), out, null); + up.uploadWithExceptionPropagation(getInputStream(req), out, + null); out.close(); } catch (ServiceMayNotContinueException e) { if (e.isOutput()) { @@ -245,7 +248,9 @@ class UploadPackServlet extends HttpServlet { log(up.getRepository(), e); if (!rsp.isCommitted()) { rsp.reset(); - sendError(req, rsp, SC_INTERNAL_SERVER_ERROR); + String msg = e instanceof PackProtocolException ? e.getMessage() + : null; + sendError(req, rsp, SC_INTERNAL_SERVER_ERROR, msg); } } } |