Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 46853 invoked from network); 4 Feb 2008 14:39:31 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 4 Feb 2008 14:39:31 -0000 Received: (qmail 61948 invoked by uid 500); 4 Feb 2008 14:39:22 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 61923 invoked by uid 500); 4 Feb 2008 14:39:22 -0000 Mailing-List: contact derby-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 61914 invoked by uid 99); 4 Feb 2008 14:39:22 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 04 Feb 2008 06:39:22 -0800 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, 04 Feb 2008 14:39:15 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 03B1771406F for ; Mon, 4 Feb 2008 06:39:08 -0800 (PST) Message-ID: <30477276.1202135948012.JavaMail.jira@brutus> Date: Mon, 4 Feb 2008 06:39:08 -0800 (PST) From: "Knut Anders Hatlen (JIRA)" To: derby-dev@db.apache.org Subject: [jira] Commented: (DERBY-3371) Strange (and untested) code fragment in RAMTransaction.addColumnToConglomerate() In-Reply-To: <30230058.1201802348390.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/DERBY-3371?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12565370#action_12565370 ] Knut Anders Hatlen commented on DERBY-3371: ------------------------------------------- Committed the test patch with revision 618299. > Strange (and untested) code fragment in RAMTransaction.addColumnToConglomerate() > -------------------------------------------------------------------------------- > > Key: DERBY-3371 > URL: https://issues.apache.org/jira/browse/DERBY-3371 > Project: Derby > Issue Type: Improvement > Components: Store > Affects Versions: 10.4.0.0 > Reporter: Knut Anders Hatlen > Priority: Minor > Attachments: test.diff > > > RAMTransaction.addColumnToConglomerate() contains this piece of code: > // remove old entry in the Conglomerate directory, and add new one > if (tempCongloms != null) > tempCongloms.remove(new Long(conglomId)); > tempCongloms.put(new Long(conglomId), conglom); > 1. According to the code coverage report (http://people.apache.org/~fuzzylogic/codecoverage/529822/_files/3fc.html#5) these lines are not tested. If possible, a test that covers them should be added to the regression suite. > 2. The null check looks either unnecessary (seems to be the case after a brief inspection of the code), or incomplete since the last line will throw a NullPointerException regardless of the check if tempCongloms is null. > 3. The call to remove() before put() is redundant, since HashMap.put() will remove the old mapping implicitly. > 4. It seems to me that the object that is put into the HashMap always is the same as the one that is removed, so perhaps all these lines could be deleted. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.