Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@www.apache.org Received: (qmail 51431 invoked from network); 1 Oct 2004 17:03:01 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 1 Oct 2004 17:03:01 -0000 Received: (qmail 93580 invoked by uid 500); 1 Oct 2004 17:02:57 -0000 Delivered-To: apmail-jakarta-commons-dev-archive@jakarta.apache.org Received: (qmail 93523 invoked by uid 500); 1 Oct 2004 17:02:56 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 93510 invoked by uid 99); 1 Oct 2004 17:02:56 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from [67.95.133.13] (HELO mailp01.arbella.com) (67.95.133.13) by apache.org (qpsmtpd/0.28) with ESMTP; Fri, 01 Oct 2004 10:02:55 -0700 Received: by corp06.arbella.com with Internet Mail Service (5.5.2657.72) id ; Fri, 1 Oct 2004 13:03:06 -0400 Message-ID: <315A739DFEA15B4E84ECB642CF36905504DD0A27@corp06.arbella.com> From: "Jung, Eric" To: "'commons-dev@jakarta.apache.org'" Subject: [configuration] JNDIConfiguration should close() its NamingEnumer ation on exception Date: Fri, 1 Oct 2004 13:03:06 -0400 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2657.72) Content-Type: text/plain X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Hi, Great job on RC2! I love it. I do have one suggestion, however, with regards to JNDIConfiguration. Three methods (recursiveGetKeys(), getContext(), and isEmpty()) use NamingEnumeration but do not call NamingEnumeration.close() if an exception is thrown while using that enumeration. All of these methods call context.lookup() while enumerating, which can throw an exception. According to the javadoc on NamingEnumeration.close(): "This method is intended for aborting an enumeration to free up resources. If an enumeration proceeds to the end--that is, until hasMoreElements() or hasMore() returns false-- resources will be freed up automatically and there is no need to explicitly call close()." With this in mind, I'd like to see NamingEnumerations wrapped in try/catch blocks with NamingEnumeration.close() called in the catch. Any thoughts? Thanks for listening. Sincerely, Eric Jung --------------------------------------------------------------------- To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-dev-help@jakarta.apache.org