commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jung, Eric" <>
Subject [configuration] JNDIConfiguration should close() its NamingEnumer ation on exception
Date Fri, 01 Oct 2004 17:03:06 GMT

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.

Eric Jung

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message