THRIFT-1404: Delphi compiler generates struct reader code with problem.
Client: delphi
Patch: Kenjiro Fukumitsu
After recieved STOP,it calls additional ReadFieldEnd, which is different from the implementation of other language compiler.
git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1189005 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/compiler/cpp/src/generate/t_delphi_generator.cc b/compiler/cpp/src/generate/t_delphi_generator.cc
index 4798b61..a7aa64a 100644
--- a/compiler/cpp/src/generate/t_delphi_generator.cc
+++ b/compiler/cpp/src/generate/t_delphi_generator.cc
@@ -2372,13 +2372,10 @@
indent_impl(code_block) << "field_ := iprot.ReadFieldBegin();" << endl;
- indent_impl(code_block) << "try" << endl;
- indent_up_impl();
-
indent_impl(code_block) << "if (field_.Type_ = TType.Stop) then" << endl;
indent_impl(code_block) << "begin" << endl;
indent_up_impl();
- indent_impl(code_block) << "break;" << endl;
+ indent_impl(code_block) << "Break;" << endl;
indent_down_impl();
indent_impl(code_block) << "end;" << endl;
@@ -2432,14 +2429,7 @@
indent_impl(code_block) << "end;" << endl;
}
-
- indent_down_impl();
-
- indent_impl(code_block) << "finally" << endl;
- indent_up_impl();
indent_impl(code_block) << "iprot.ReadFieldEnd;" << endl;
- indent_down_impl();
- indent_impl(code_block) << "end;" << endl;
indent_down_impl();
diff --git a/lib/delphi/src/Thrift.Transport.pas b/lib/delphi/src/Thrift.Transport.pas
index 0e6f825..a460819 100644
--- a/lib/delphi/src/Thrift.Transport.pas
+++ b/lib/delphi/src/Thrift.Transport.pas
@@ -959,7 +959,7 @@
begin
if FOutputStream = nil then
begin
- raise TTransportException.Create( TTransportException.TExceptionType.NotOpen, 'Cannot read from null outputstream' );
+ raise TTransportException.Create( TTransportException.TExceptionType.NotOpen, 'Cannot write to null outputstream' );
end;
FOutputStream.Write( buf, off, len );