Return-Path: X-Original-To: apmail-db-derby-dev-archive@www.apache.org Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A529C90F6 for ; Fri, 25 May 2012 10:46:25 +0000 (UTC) Received: (qmail 29751 invoked by uid 500); 25 May 2012 10:46:25 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 29607 invoked by uid 500); 25 May 2012 10:46:25 -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 29587 invoked by uid 99); 25 May 2012 10:46:24 -0000 Received: from issues-vm.apache.org (HELO issues-vm) (140.211.11.160) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 25 May 2012 10:46:24 +0000 Received: from isssues-vm.apache.org (localhost [127.0.0.1]) by issues-vm (Postfix) with ESMTP id CBD661418B6 for ; Fri, 25 May 2012 10:46:23 +0000 (UTC) Date: Fri, 25 May 2012 10:46:23 +0000 (UTC) From: "Knut Anders Hatlen (JIRA)" To: derby-dev@db.apache.org Message-ID: <209159591.1342.1337942783836.JavaMail.jiratomcat@issues-vm> Subject: [jira] [Resolved] (DERBY-3371) Strange (and untested) code fragment in RAMTransaction.addColumnToConglomerate() 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/DERBY-3371?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Knut Anders Hatlen resolved DERBY-3371. --------------------------------------- Resolution: Fixed Fix Version/s: 10.10.0.0 Issue & fix info: (was: Patch Available) Committed revision 1342566. > 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.1.3 > Reporter: Knut Anders Hatlen > Assignee: Knut Anders Hatlen > Priority: Minor > Fix For: 10.10.0.0 > > Attachments: remove.diff, 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. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira