THRIFT-5438 Inconsistent handling of exceptions during message read vs. message write phase
Client: Delphi
Patch: Jens Geyer
diff --git a/compiler/cpp/src/thrift/generate/t_delphi_generator.cc b/compiler/cpp/src/thrift/generate/t_delphi_generator.cc
index eac46a6..8383cea 100644
--- a/compiler/cpp/src/thrift/generate/t_delphi_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_delphi_generator.cc
@@ -2534,6 +2534,13 @@
   indent_impl(s_service_impl) << "begin" << endl;
   indent_up_impl();
 
+  if (!tfunction->is_oneway()) {
+    indent_impl(s_service_impl) << "ret := " << result_clsnm << "Impl.Create;" << endl;
+  }
+
+  indent_impl(s_service_impl) << "try" << endl;
+  indent_up_impl();
+
   if (events_) {
     indent_impl(s_service_impl) << "if events <> nil then events.PreRead;" << endl;
   }
@@ -2548,13 +2555,6 @@
   const std::vector<t_field*>& xceptions = xs->get_members();
   vector<t_field*>::const_iterator x_iter;
 
-  if (!tfunction->is_oneway()) {
-    indent_impl(s_service_impl) << "ret := " << result_clsnm << "Impl.Create;" << endl;
-  }
-
-  indent_impl(s_service_impl) << "try" << endl;
-  indent_up_impl();
-
   t_struct* arg_struct = tfunction->get_arglist();
   const std::vector<t_field*>& fields = arg_struct->get_members();
   vector<t_field*>::const_iterator f_iter;
diff --git a/lib/delphi/test/TestClient.pas b/lib/delphi/test/TestClient.pas
index c8d3fc2..df0b4c5 100644
--- a/lib/delphi/test/TestClient.pas
+++ b/lib/delphi/test/TestClient.pas
@@ -53,7 +53,6 @@
   Thrift.Test,
   Thrift.WinHTTP,
   Thrift.Utils,
-
   Thrift.Configuration,
   Thrift.Collections;
 
diff --git a/lib/delphi/test/client.dproj b/lib/delphi/test/client.dproj
index 8df93a0..c57424d 100644
--- a/lib/delphi/test/client.dproj
+++ b/lib/delphi/test/client.dproj
@@ -142,9 +142,7 @@
 						<VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
 						<VersionInfoKeys Name="Comments"/>
 					</VersionInfoKeys>
-					<Parameters>
-						<Parameters Name="RunParams"> --transport=framed --transport=winhttp --host=example.org --port=80</Parameters>
-					</Parameters>
+					<Parameters/>
 				</Delphi.Personality>
 				<Platforms>
 					<Platform value="Win32">True</Platform>