]> source.dussan.org Git - jgit.git/commit
Ensure all smart HTTP errors are sent to clients 15/4715/1
authorShawn O. Pearce <spearce@spearce.org>
Thu, 1 Dec 2011 01:28:54 +0000 (17:28 -0800)
committerShawn O. Pearce <spearce@spearce.org>
Fri, 2 Dec 2011 00:01:11 +0000 (16:01 -0800)
commitac6cda955c6859d57ba1a705ac1c2786a16b8b14
tree3a87fc433656e0bfe89f619b2bd1174ceb9f27ff
parent0d61707f12b5b1a94b325fc8c2975a9e60a14dac
Ensure all smart HTTP errors are sent to clients

Error messages are typically short, below the 32 KiB in-memory buffer
size of the SmartOutputStream. When an error is queued up for sending
to a client and an exception is thrown up into the servlet handler we
discarded the message and sent nothing to the client, as the messages
were stuck inside of the SmartOutputStream buffer.

Hoist the creation of the output stream above the invocation of try
block of the service, and use close() in the few catch blocks that
assume there are buffered messages ready for transmission. This will
ensure errors from unpacking a stream in ReceivePack are sent off to
a client correctly, as previously these were causing no status report
to arrive at the client side as the data was stuck in the buffer.

Change-Id: I5534b560697731121f48979ae077aa7c95b8e39c
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/ReceivePackServlet.java
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/UploadPackServlet.java
org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/ProtocolErrorTest.java [new file with mode: 0644]