[Building Sakai] JLDAP connection

Alexandre Ballesté alexandre.balleste at udl.cat
Mon Feb 25 08:57:56 PST 2013


It seems like I asked a first course java programming question. :) shame on me. For a long time I believed that 'return' was the absolutly last statement executed in a function.

Thanks Sam for the answer. 

Sam Ottenhoff <ottenhoff at longsight.com> wrote:

>> My first impression is that ldap connection is not closed if the
>> getBoundConnection is successful or when an Exception is fired and is
>> INVALID_CREDENTIALS type.  My question are... Is that true? Does
>exist a
>> reason for not closing the connection before return statement? Is not
>> necessary close the connections?
>>
>
>
>The finally block *always* executes when the try block exits. This
>ensures
>that the finally block is executed even if an unexpected exception
>occurs.
>But finally is useful for more than just exception handling — it allows
>the
>programmer to avoid having cleanup code accidentally bypassed by a
>return,
>continue, or break. Putting cleanup code in a finally block is always a
>good practice, even when no exceptions are anticipated.
>
>-- 
>http://docs.oracle.com/javase/tutorial/essential/exceptions/finally.html

-- 
Sent from my Galaxy Note II. Please excuse my brevity.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20130225/56667900/attachment.html 


More information about the sakai-dev mailing list