Return-Path: Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: (qmail 56556 invoked from network); 9 Apr 2011 19:58:44 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 9 Apr 2011 19:58:44 -0000 Received: (qmail 89408 invoked by uid 500); 9 Apr 2011 19:58:43 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 89347 invoked by uid 500); 9 Apr 2011 19:58:43 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 89339 invoked by uid 99); 9 Apr 2011 19:58:43 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 09 Apr 2011 19:58:43 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 09 Apr 2011 19:58:42 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id B2E739AA79 for ; Sat, 9 Apr 2011 19:58:05 +0000 (UTC) Date: Sat, 9 Apr 2011 19:58:05 +0000 (UTC) From: "Simone Tripodi (JIRA)" To: issues@commons.apache.org Message-ID: <1180154676.46839.1302379085729.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <1246606496.44041.1302279366222.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Resolved] (DISCOVERY-17) Enumeration returned by Service.providers has a broken behavior 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/DISCOVERY-17?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Simone Tripodi resolved DISCOVERY-17. ------------------------------------- Resolution: Fixed fixed on trunk, please review Service r1090660 > Enumeration returned by Service.providers has a broken behavior > --------------------------------------------------------------- > > Key: DISCOVERY-17 > URL: https://issues.apache.org/jira/browse/DISCOVERY-17 > Project: Commons Discovery > Issue Type: Bug > Affects Versions: 0.5 > Reporter: Simone Tripodi > Assignee: Simone Tripodi > Fix For: 0.5 > > Attachments: org.apache.commons.logging.Log > > Original Estimate: 20m > Remaining Estimate: 20m > > I find the current Enumeration behavior broken, but please tell me if I'm wrong!!! > This is the actual current behavior: > {code} > return new Enumeration() { > private S object = getNextClassInstance(); > public boolean hasMoreElements() { > return object != null; > } > public S nextElement() { > if (object == null) { > throw new NoSuchElementException(); > } > S obj = object; > object = getNextClassInstance(); > return obj; > } > private S getNextClassInstance() { > while (services.hasNext()) { > ResourceClass info = services.nextResourceClass(); > try { > return spi.newInstance(info.loadClass()); > } catch (Exception e) { > // ignore > } catch (UnsatisfiedLinkError ule) { > // ignore > } catch (ExceptionInInitializerError eiie) { > // ignore > } > } > return null; > } > }; > {code} > but it should be > {code} > return new Enumeration() { > public boolean hasMoreElements() { > return services.hasNext(); > } > public S nextElement() { > ResourceClass info = services.nextResourceClass(); > try { > return spi.newInstance(info.loadClass()); > } catch (Exception e) { > // ignore > } catch (UnsatisfiedLinkError ule) { > // ignore > } catch (ExceptionInInitializerError eiie) { > // ignore > } > return null; > } > }; > {code} > I think there's no need to comment both codes, please tell me why the first one should be right :P -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira