Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 34264 invoked from network); 18 Jun 2007 07:09:49 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 18 Jun 2007 07:09:49 -0000 Received: (qmail 72709 invoked by uid 500); 18 Jun 2007 07:09:52 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 72694 invoked by uid 500); 18 Jun 2007 07:09:52 -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 72685 invoked by uid 99); 18 Jun 2007 07:09:52 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 18 Jun 2007 00:09:52 -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; Mon, 18 Jun 2007 00:09:48 -0700 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 87F8071419B for ; Mon, 18 Jun 2007 00:09:27 -0700 (PDT) Message-ID: <24347375.1182150567553.JavaMail.jira@brutus> Date: Mon, 18 Jun 2007 00:09:27 -0700 (PDT) From: "Ruth Cao (JIRA)" To: commits@harmony.apache.org Subject: [jira] Updated: (HARMONY-4205) [classlib][sql] java.sql.DriverManager cannot deregister a driver as many times a registering it In-Reply-To: <19525038.1182150231240.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-4205?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Ruth Cao updated HARMONY-4205: ------------------------------ Attachment: Harmony-4205.diff May somebody pls try this? > [classlib][sql] java.sql.DriverManager cannot deregister a driver as many times a registering it > ------------------------------------------------------------------------------------------------ > > Key: HARMONY-4205 > URL: https://issues.apache.org/jira/browse/HARMONY-4205 > Project: Harmony > Issue Type: Bug > Components: Classlib > Environment: Windows XP / Linux > Reporter: Ruth Cao > Attachments: Harmony-4205.diff > > > The following test case shows the bug: > public void test_registerDriver_MultiTimes() throws SQLException { > int register_count = 10; > int deregister_count = 1; > Driver dummy = new DummyDriver(); > DriverManager.registerDriver(new BadDummyDriver()); > for (int i = 0; i < register_count; i++) { > DriverManager.registerDriver(dummy); > } > DriverManager.registerDriver(new BadDummyDriver()); > for (int i = 0; i < deregister_count; i++) { > DriverManager.deregisterDriver(dummy); > } > Driver d = DriverManager.getDriver("jdbc:dummy_protocol:dummy_subname"); > assertNotNull(d); > } > > private static class BadDummyDriver extends DummyDriver { > public boolean acceptsURL(String url) { > return false; > } > } > private static class DummyDriver implements Driver { > String goodurl = "jdbc:dummy_protocol:dummy_subname"; > public boolean acceptsURL(String url) { > return url.equals(goodurl); > } > public Connection connect(String url, Properties info) { > return null; > } > public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) { > return null; > } > public int getMajorVersion() { > return 0; > } > public int getMinorVersion() { > return 0; > } > public boolean jdbcCompliant() { > return true; > } > } > It seems that this happens due to Harmony uses HashSet as the data structure to store the driver list, which does not allow duplications. > I'll create a patch for this soon, thanks. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.