Repository: thrift Updated Branches: refs/heads/master 20bcf38be -> 057be5a9b
THRIFT-2470 THttpHandler swallows exceptions from processor Client: C# Patch: Adam Conelly This closes #100 commit 6dcb1c3dc5d3259574863f0bc6af67b241b4653e Author: Adam Connelly <[email protected]> Date: 2014-04-16T14:37:54Z THRIFT-2470: Stop THttpHandler from swallowing processor exceptions The problem with the way it works currently is that it makes it very difficult to figure out what's going on when I've got a handler running on a remote web server. If the handler just allows the exceptions to bubble up like normal, they get caught by our normal exception handling code and logged. I also added a new project for unit tests, and some tests for the changes I've made. Project: http://git-wip-us.apache.org/repos/asf/thrift/repo Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/057be5a9 Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/057be5a9 Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/057be5a9 Branch: refs/heads/master Commit: 057be5a9bd32e3571577edeab1aa0ea7c50087d6 Parents: 20bcf38 Author: Jens Geyer <[email protected]> Authored: Wed Apr 16 22:43:08 2014 +0200 Committer: Jens Geyer <[email protected]> Committed: Wed Apr 16 22:43:08 2014 +0200 ---------------------------------------------------------------------- lib/csharp/src/Transport/THttpHandler.cs | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/thrift/blob/057be5a9/lib/csharp/src/Transport/THttpHandler.cs ---------------------------------------------------------------------- diff --git a/lib/csharp/src/Transport/THttpHandler.cs b/lib/csharp/src/Transport/THttpHandler.cs index 0a10d79..884f1ad 100644 --- a/lib/csharp/src/Transport/THttpHandler.cs +++ b/lib/csharp/src/Transport/THttpHandler.cs @@ -63,30 +63,23 @@ namespace Thrift.Transport { TTransport transport = new TStreamTransport(input,output); - TProtocol inputProtocol = null; - TProtocol outputProtocol = null; - try { - inputProtocol = inputProtocolFactory.GetProtocol(transport); - outputProtocol = outputProtocolFactory.GetProtocol(transport); + var inputProtocol = inputProtocolFactory.GetProtocol(transport); + var outputProtocol = outputProtocolFactory.GetProtocol(transport); - while (processor.Process(inputProtocol, outputProtocol)) { } + while (processor.Process(inputProtocol, outputProtocol)) + { + } } catch (TTransportException) { // Client died, just move on } - catch (TApplicationException tx) - { - Console.Error.Write(tx); - } - catch (Exception x) + finally { - Console.Error.Write(x); + transport.Close(); } - - transport.Close(); } public bool IsReusable
