Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 312F2200CC5 for ; Tue, 11 Jul 2017 11:38:58 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 2FB87165888; Tue, 11 Jul 2017 09:38:58 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 7E356165884 for ; Tue, 11 Jul 2017 11:38:57 +0200 (CEST) Received: (qmail 81041 invoked by uid 500); 11 Jul 2017 09:38:54 -0000 Mailing-List: contact issues-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list issues@cxf.apache.org Received: (qmail 81024 invoked by uid 99); 11 Jul 2017 09:38:54 -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; Tue, 11 Jul 2017 09:38:54 +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 DDE51195443 for ; Tue, 11 Jul 2017 09:38:53 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.202 X-Spam-Level: X-Spam-Status: No, score=-99.202 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id ZfhnYHlHibxH for ; Tue, 11 Jul 2017 09:38:53 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 6366162734 for ; Tue, 11 Jul 2017 09:29:02 +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 B39DBE0A75 for ; Tue, 11 Jul 2017 09:29:01 +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 990B2246BE for ; Tue, 11 Jul 2017 09:29:00 +0000 (UTC) Date: Tue, 11 Jul 2017 09:29:00 +0000 (UTC) From: "Christian Schneider (JIRA)" To: issues@cxf.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (DOSGI-254) ServiceInvocationHandler does not handle checked super-interface exceptions correctly MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Tue, 11 Jul 2017 09:38:58 -0000 [ https://issues.apache.org/jira/browse/DOSGI-254?page=3Dcom.atlassian= .jira.plugin.system.issuetabpanels:all-tabpanel ] Christian Schneider updated DOSGI-254: -------------------------------------- Fix Version/s: 2.3.0 > ServiceInvocationHandler does not handle checked super-interface exceptio= ns correctly > -------------------------------------------------------------------------= ------------ > > Key: DOSGI-254 > URL: https://issues.apache.org/jira/browse/DOSGI-254 > Project: CXF Distributed OSGi > Issue Type: Bug > Components: common > Affects Versions: 2.0.0 > Reporter: Panu H=C3=A4m=C3=A4l=C3=A4inen > Assignee: Christian Schneider > Fix For: 2.3.0 > > > If a remote service interface is composed of an interface hierarchy, the = ServiceInvocationHandler (in org.apache.cxf.dosgi.dsw.handlers package on 1= .7.0) only handles correctly the checked exceptions of the interface the s= ervice directly implements/exports (the lowest level interface of the hiera= rchy). The checked exceptions of the superinterface methods are thrown as g= eneric ServiceExceptions (which are RuntimeExceptions).=20 > For example below, the IOException thrown by the throwBaseException metho= d gets converted to ServiceException while the URISyntaxException thrown by= the throwSubException method remains correctly as URISyntaxException. The = service is exported as a TestSubInterface service. > {code} > public interface TestBaseInterface { > void throwBaseException() throws IOException; > } > =20 > public interface TestSubInterface extends TestBaseInterface { > void throwSubException() throws URISyntaxException; > } > public class TestClass implements TestSubInterface { > @Override > public void throwBaseException() throws IOException { > throw new IOException("expected baseinterface exception"); > } > @Override > public void throwSubException() throws URISyntaxException { > throw new URISyntaxException("some input", "expected subinter= face exception"); > } > } > {code} > I have been using DOSGi 1.7.0 but I also checked version 2.0.0 and Servic= eInvocationHandler (now in org.apache.cxf.dosgi.common.proxy package) seems= the same as in previous releases. > The problem seems to be in ServiceInvocationHandler in the method > {code} > private void introspectType(Class iType) { > for (Method m : iType.getDeclaredMethods()) { > for (Class excType : m.getExceptionTypes()) { > if (Exception.class.isAssignableFrom(excType)) { > List> types =3D exceptionsMap.get(m); > if (types =3D=3D null) { > types =3D new ArrayList>(); > exceptionsMap.put(m, types); > } > types.add(excType); > } > } > } > } > {code} > for which the javadocs of iType.getDeclaredMethods() say "Returns an arr= ay of Method objects reflecting all the methods declared by the class or in= terface represented by this Class object. This includes public, protected, = default (package) access, and private methods, *but excludes inherited meth= ods*."=20 > The introspectType method should be changed so that it also processes at = least the public methods of the superinterfaces/classes. This can be achiev= ed e.g. with iType.getMethods(). -- This message was sent by Atlassian JIRA (v6.4.14#64029)