I'm trying to pin down a problem with components in Cocoon 2 at the moment 
and was trying to get to grips with Avalon.  I ran across the following 
code which didn't look like what I was expecting...

"hasComponent()" which seems like a benign test, has the side-effect of 
'releasing' a component and appears to rely on "release()" not raising an 
exception as the basis for determining the component's existence:

ExcaliburComponentSelector.java:
>     /**
>      * Tests for existence of a component.
>      */
>     public boolean hasComponent( final Object hint )
>     {
>         if ( ! m_initialized ) return false;
>         if ( m_disposed ) return false;
>
>         boolean exists = false;
>
>         try
>         {
>             this.release( this.select( hint ) );
>             exists = true;
>         }
>         catch ( Throwable t )
>         {
>             // We can safely ignore all exceptions
>         }
>
>         return exists;
>     }

Apologies in advance if I'm being particularly stupid today! :-)

Stuart.

-------------------------------------------------------------------------
Stuart Roebuck                                  [EMAIL PROTECTED]
Lead Developer                               Java, XML, MacOS X, XP, etc.
ADOLOS                                           <http://www.adolos.com/>

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

Reply via email to