[Building Sakai] JLDAP connection

Sam Ottenhoff ottenhoff at longsight.com
Mon Feb 25 08:08:26 PST 2013


> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20130225/3371db29/attachment.html 


More information about the sakai-dev mailing list