On Fri, 10 Aug 2001, Leo Sutic wrote:

> All,
>
> is it part of the contract for ComponentManager.release that the component
> parameter may be null?
>
> In ExcaliburComponentManager.release the method has a test at the top:
>
>   if ( null == component )
>   {
>       return;
>   }
>
> So one can write:
>
> MyComponent myComponent = null;
> try {
>     myComponent = manager.lookup (MyComponent.ROLE);
>     ...
> } finally {
>     manager.release (myComponent);
> }
>
> Instead of:
>
> MyComponent myComponent = null;
> try {
>     myComponent = manager.lookup (MyComponent.ROLE);
>     ...
> } finally {
>     if (myComponent != null) {
>         manager.release (myComponent);
>     }
> }
>
> I like this - one less "if" statement for me to forget. However, there is no
> mention of this in the documentation. So my question is: Is this part of the
> ComponentManager interface?

I agree this would be a nice convenience and we should document it.

Giacomo


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to