From dev-return-52627-archive-asf-public=cust-asf.ponee.io@thrift.apache.org Thu May 3 09:08:05 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id A83D2180625 for ; Thu, 3 May 2018 09:08:04 +0200 (CEST) Received: (qmail 19336 invoked by uid 500); 3 May 2018 07:08:03 -0000 Mailing-List: contact dev-help@thrift.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@thrift.apache.org Delivered-To: mailing list dev@thrift.apache.org Received: (qmail 19325 invoked by uid 99); 3 May 2018 07:08:03 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 03 May 2018 07:08:03 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 09E5518048D for ; Thu, 3 May 2018 07:08:03 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -109.511 X-Spam-Level: X-Spam-Status: No, score=-109.511 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, KAM_ASCII_DIVIDERS=0.8, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01, USER_IN_DEF_SPF_WL=-7.5, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id N1TfSGsFGtZb for ; Thu, 3 May 2018 07:08:01 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 2F27A5F189 for ; Thu, 3 May 2018 07:08:01 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 68E29E00D3 for ; Thu, 3 May 2018 07:08:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 192D421296 for ; Thu, 3 May 2018 07:08:00 +0000 (UTC) Date: Thu, 3 May 2018 07:08:00 +0000 (UTC) From: "Jens Geyer (JIRA)" To: dev@thrift.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Resolved] (THRIFT-4562) Calling wrong exception CTOR leads to "call failed: unknown result" instead of the real exception being thrown MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/THRIFT-4562?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Jens Geyer resolved THRIFT-4562. -------------------------------- Resolution: Fixed Assignee: Jens Geyer Fix Version/s: 0.12.0 Committed. > Calling wrong exception CTOR leads to "call failed: unknown result" instead of the real exception being thrown > -------------------------------------------------------------------------------------------------------------- > > Key: THRIFT-4562 > URL: https://issues.apache.org/jira/browse/THRIFT-4562 > Project: Thrift > Issue Type: Bug > Components: Delphi - Compiler > Reporter: Jens Geyer > Assignee: Jens Geyer > Priority: Major > Fix For: 0.12.0 > > > h2. Problem > # In contrast to other languages, there is no real way to prevent Delphi from inheriting unwanted CTORs. > # The generated code initializes an "exception factory" helper object used for serializing the exception info over the wire. This helper object is instantiated in two cases: > ** a) in the CTORs that are defined in the exception class > ** b) when a property setter is called on that instance > h2. Example > The following IDL: > {code:java} > exception ApiException { > 1: string Msg > 2: i32 Error > } > {code} > results in this Delphi code: > {code:java} > TApiException = class(TException) > // ... some unrelevant details omitted ... > public > constructor Create; overload; > constructor Create( const AMsg: System.string; AError: System.Integer); overload; > // ... more code ... > end; > {code} > Due to the inheritance from {{TException}} and finally {{System.Exception}}, a bunch of other CTORs is inherited, such as: > {code:java} > constructor Create(const Msg: string); > {code} > From this, a situation may arise, in which the developer instantiates the instance by calling one of the inherited CTORs (which do not intialize the Factory helper object), then raising the exception without assigning any other values via property setter: > {code} > raise TApiException.Create('some error occurred!'); // inherited CTOR > {code} > instead of > {code} > raise TApiException.Create('some error occurred!', 42); // TApiException CTOR > {code} > Under these circumstances, the Factory helper object is left at its default value of {{nil}}, hence no suitable information is written to the wire. As a direct result, being unable to deserialize anything useful on return, the client code will run into the default catcher code which raises an generic TApplicationException with {{MissingResult}} code and the "call failed: unknown result" message. -- This message was sent by Atlassian JIRA (v7.6.3#76005)