Return-Path: Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: (qmail 13581 invoked from network); 27 Jan 2009 01:12:55 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 27 Jan 2009 01:12:55 -0000 Received: (qmail 1851 invoked by uid 500); 27 Jan 2009 01:12:53 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 1783 invoked by uid 500); 27 Jan 2009 01:12:53 -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 1772 invoked by uid 99); 27 Jan 2009 01:12:53 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 26 Jan 2009 17:12:53 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 26 Jan 2009 22:46:20 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 912F4234C48B for ; Mon, 26 Jan 2009 14:45:59 -0800 (PST) Message-ID: <834376299.1233009959579.JavaMail.jira@brutus> Date: Mon, 26 Jan 2009 14:45:59 -0800 (PST) From: "Sebb (JIRA)" To: issues@commons.apache.org Subject: [jira] Reopened: (DBCP-280) SequencedHashMap constructor calls overridable method; throws Error In-Reply-To: <1954707823.1232927579635.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/DBCP-280?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Sebb reopened DBCP-280: ----------------------- I don't see how the scope or the origin of the code affects this. If the class will never be extended, then make the class final. If the method will never be overridden, then make the method final. Otherwise, extract the code into a private method as originally suggested. Since the fix to make the code safe is easy to do, it seems to me that it is worth doing to avoid potential problems later. I.e. defensive programming. > SequencedHashMap constructor calls overridable method; throws Error > ------------------------------------------------------------------- > > Key: DBCP-280 > URL: https://issues.apache.org/jira/browse/DBCP-280 > Project: Commons Dbcp > Issue Type: Bug > Reporter: Sebb > > The constructor SequencedHashMap(Map) calls the public non-final method putAll(). > This is likely to cause problems if the class is ever extended. Possible solution: extract the code into a common private method. > The next() method also throws an Error if the return type is unexpected. > It should probably return IllegalStateException or similar. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.