Hi Mark;

Good point :) It seems meaningless to do so.

 In the specification says that
"If any exception occurs while creating the instance , the exception is throws 
by the create() method. If the exception is the checked exception, it is 
wrapped and and rethrown as an (unchecked) CreationException". 

I suspect that I did it wrongly. we may change *Exception* to the 
*RuntimeException* as 
        catch (Throwable e)
        {
            if (RuntimeException.class.isAssignableFrom(e.getClass()))
            {
                throw new CreationException(e);
            }
                else
                {
                    throw new WebBeansException(e);
                }
        }


/Gurkan


________________________________
From: Mark Struberg <[email protected]>
To: [email protected]
Sent: Monday, January 12, 2009 12:33:59 PM
Subject: Throwable catching question

Hi Gurkan!

I have a question about a construct I saw some times (e.g. in 
AbstracCommponent#create() ) and I frankly do not understand what it's good for:

        catch (Throwable e)
        {
            if (Exception.class.isAssignableFrom(e.getClass()))
            {
                throw new CreationException(e);
            }
        }

So all Errors (like e.g. ThreadDead) are silently catched away?
Is there any reason for this?

Why not simply do a:

        catch (Exception e)
        {
            throw new CreationException(e);
        }


Or did I miss something?

txs and LieGrue,
strub


      

Reply via email to