Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 98355 invoked from network); 5 Jul 2007 06:38:26 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 5 Jul 2007 06:38:26 -0000 Received: (qmail 37852 invoked by uid 500); 5 Jul 2007 06:38:28 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 37836 invoked by uid 500); 5 Jul 2007 06:38:28 -0000 Mailing-List: contact commits-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list commits@harmony.apache.org Received: (qmail 37814 invoked by uid 99); 5 Jul 2007 06:38:28 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 Jul 2007 23:38:28 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 Jul 2007 23:38:24 -0700 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id CBE7D71422C for ; Wed, 4 Jul 2007 23:38:04 -0700 (PDT) Message-ID: <23085867.1183617484832.JavaMail.jira@brutus> Date: Wed, 4 Jul 2007 23:38:04 -0700 (PDT) From: "spark shen (JIRA)" To: commits@harmony.apache.org Subject: [jira] Updated: (HARMONY-4344) [classlib][beans] BeanContextServicesSupport.serviceAvailable will add duplicate service class In-Reply-To: <9857436.1183616224644.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/HARMONY-4344?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] spark shen updated HARMONY-4344: -------------------------------- Attachment: (was: HY-4321.diff) > [classlib][beans] BeanContextServicesSupport.serviceAvailable will add duplicate service class > ----------------------------------------------------------------------------------------------- > > Key: HARMONY-4344 > URL: https://issues.apache.org/jira/browse/HARMONY-4344 > Project: Harmony > Issue Type: Bug > Components: Classlib > Reporter: spark shen > > The following test case will fail on Harmony but pass on RI: > static int serviceRevoked = 0; > static int serviceAvailable = 0; > private static class MyListener implements BeanContextServicesListener { > public void serviceRevoked(BeanContextServiceRevokedEvent event) { > serviceRevoked++; > } > public void serviceAvailable(BeanContextServiceAvailableEvent event) { > serviceAvailable++; > } > } > private static class MySupport extends BeanContextServicesSupport { > public void serviceRevoked(BeanContextServiceRevokedEvent event) { > serviceRevoked++; > } > > public void serviceAvailable(BeanContextServiceAvailableEvent event) { > serviceAvailable++; > } > } > private static class MyProvider implements BeanContextServiceProvider { > public void releaseService(BeanContextServices s, Object requestor, > Object service) { > } > public Iterator getCurrentServiceSelectors(BeanContextServices s, > Class serviceClass) { > return null; > } > public Object getService(BeanContextServices s, Object requestor, > Class serviceClass, Object serviceSelector) { > return null; > } > } > public void test_serviceAvailable_LBeanContextServiceRevokedEvent() { > BeanContextServicesSupport support = new BeanContextServicesSupport(); > support.add(new MySupport()); > support.addBeanContextServicesListener(new MyListener()); > Class c = Object.class; > support.addService(c, new MyProvider()); > BeanContextServiceAvailableEvent availableEvent = new BeanContextServiceAvailableEvent( > support, c); > support.serviceAvailable(availableEvent); > assertEquals(2, serviceAvailable); > > } > Seems that serviceAvailable method does not judge whether the availableEvent.serviceClass has already be registered. > BeanContextServicesSupport.serviceRevoked method has similar defect. It can be revealed by the following test case: > public void test_serviceRevoked_LBeanContextServiceRevokedEvent() { > BeanContextServicesSupport support = new BeanContextServicesSupport(); > support.add(new MySupport()); > support.addBeanContextServicesListener(new MyListener()); > Class c = Object.class; > support.addService(c, new MyProvider()); > BeanContextServiceRevokedEvent revokeEvent = new BeanContextServiceRevokedEvent( > support, c, false); > support.serviceRevoked(revokeEvent); > assertEquals(0, serviceRevoked); > } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.