From: Jake Farrell Date: Mon, 31 Oct 2011 14:07:14 +0000 (+0000) Subject: Thrift-1408: Delphi Test Server: Exception test case fails due to naming conflict... X-Git-Tag: 0.8.0~38 X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=73a921f85c57fd9dda26f91405999455eab8582b;p=common%2Fthrift.git Thrift-1408: Delphi Test Server: Exception test case fails due to naming conflict with e.message Client: delphi Patch: jens Geyer Fix name comflict with e.message git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1195461 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 fc684dfe..569afe3f 100644 --- a/compiler/cpp/src/generate/t_delphi_generator.cc +++ b/compiler/cpp/src/generate/t_delphi_generator.cc @@ -981,7 +981,7 @@ void t_delphi_generator::generate_delphi_struct_definition(ostream &out, t_struc } out << "class("; if ( is_exception && (! is_x_factory)) { - out << "Exception"; + out << "TException"; } else { out << "TInterfacedObject, IBase, " << struct_intf_name; } diff --git a/lib/delphi/src/Thrift.pas b/lib/delphi/src/Thrift.pas index 6f352b1a..48c3d472 100644 --- a/lib/delphi/src/Thrift.pas +++ b/lib/delphi/src/Thrift.pas @@ -54,8 +54,22 @@ type procedure Write( oprot: IProtocol ); end; + // base class for IDL-generated exceptions + TException = class( SysUtils.Exception) + public + procedure Message; // hide inherited property to prevent accidental read/write + end; + implementation +{ TException } + +procedure TException.Message; +// hide inherited property to prevent accidental read/write +begin + ASSERT( FALSE, 'Unexpected call to '+ClassName+'.message. Forgot the underscore?'); +end; + { TApplicationException } constructor TApplicationException.Create; diff --git a/lib/delphi/test/TestServer.pas b/lib/delphi/test/TestServer.pas index c120712d..67cce776 100644 --- a/lib/delphi/test/TestServer.pas +++ b/lib/delphi/test/TestServer.pas @@ -276,7 +276,7 @@ begin begin x := TXception.Create; x.ErrorCode := 1001; - x.Message := 'This is an Xception'; + x.Message_ := 'This is an Xception'; raise x; end else if ( arg0 = 'Xception2') then