Return-Path: X-Original-To: apmail-felix-dev-archive@www.apache.org Delivered-To: apmail-felix-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3483A10BA1 for ; Tue, 18 Jun 2013 08:07:31 +0000 (UTC) Received: (qmail 66006 invoked by uid 500); 18 Jun 2013 08:07:29 -0000 Delivered-To: apmail-felix-dev-archive@felix.apache.org Received: (qmail 65902 invoked by uid 500); 18 Jun 2013 08:07:25 -0000 Mailing-List: contact dev-help@felix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@felix.apache.org Delivered-To: mailing list dev@felix.apache.org Received: (qmail 65822 invoked by uid 99); 18 Jun 2013 08:07:21 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 18 Jun 2013 08:07:21 +0000 Date: Tue, 18 Jun 2013 08:07:21 +0000 (UTC) From: "Guillaume Nodet (JIRA)" To: dev@felix.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (FELIX-1131) ServiceReference.isAssignableTo fails when using a factory that can not see the exported class and the bundle exporting the service does not have a direct wire to this class 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/FELIX-1131?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Guillaume Nodet updated FELIX-1131: ----------------------------------- Attachment: FELIX-1131.txt Attached is a better diff which, in addition to checking imported packages, also checks exported packages and early succeed / fail when one bundle is importing and the other one exporting the same package. > ServiceReference.isAssignableTo fails when using a factory that can not see the exported class and the bundle exporting the service does not have a direct wire to this class > ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- > > Key: FELIX-1131 > URL: https://issues.apache.org/jira/browse/FELIX-1131 > Project: Felix > Issue Type: Bug > Components: Framework > Affects Versions: framework-1.6.0 > Reporter: Guillaume Nodet > Assignee: Richard S. Hall > Attachments: FELIX-1131.txt > > > * bundle A defines an interface R and a class S in different packages, whith S implementing R > * bundle B defines a class T extending S, it has an import statement on S package, but not on R package > * bundle C defines a ServiceFactory that export T service without any import on any package from R, S, T > in this case, the line 426 of ServiceRegistrationImpl is executed: > allow = getServiceRegistration().isClassAccessible(requestClass); > which looks like: > protected boolean isClassAccessible(Class clazz) > { > try > { > // Try to load from the service object or service factory class. > Class sourceClass = (m_factory != null) > ? m_factory.getClass() : m_svcObj.getClass(); > Class targetClass = Util.loadClassUsingClass(sourceClass, clazz.getName()); > return (targetClass == clazz); > } > catch (Exception ex) > { > // Ignore this and return false. > } > return false; > } > So felix checks if the classloader used to load the factory can also load the interface, which is not the case in my example. > So isClassAccessible returns false and the event is not dispatched to the service listener. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira