cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bruno Dumon <br...@outerthought.org>
Subject Re: Should we catch java.lang.Error? (was RE: XMLForm and sitemap problem (fwd))
Date Thu, 08 May 2003 15:19:33 GMT
On Thu, 2003-05-08 at 17:05, Vadim Gritsenko wrote:
> Bertrand Delacretaz wrote:
> 
> > Le Jeudi, 8 mai 2003, à 16:11 Europe/Zurich, Vadim Gritsenko a écrit :
> >
> >> ..There is one particular example of NoClassDefFoundError in 
> >> ServerPagesGenerator, you may want to look at it... For 
> >> inspiration... ;)
> >
> >
> > } catch (NoClassDefFoundError e) {
> >             // VG: Usually indicates that page invoked with the wrong 
> > case.
> >             // I.e., it was compiled as "my.xsp" and inoked as "My.xsp",
> >             // results in different class name and an error.
> >             getLogger().warn("Failed to load class: " + e);
> >             throw new ResourceNotFoundException(e.getMessage());
> >         }
> >
> > Yes, looks good when you know precisely why you're getting such an 
> > exception.
> >
> > But I think the discussion was about catching Errors or 
> > NoClassDefFoundError at a more global level, isn't it? 
> 
> 
> How about more local approach? Say, catch NoClassDefFoundError in 
> treeprocessor when it creates component handlers... Then it's clear that 
> the problem is because component is missing.
> 

But in Sylvain T's case, the error was not thrown because his action was
missing, but it was thrown by some library he was using (or because that
library was missing).

So according to the above reasoning, he would have to catch the
NoClassDefFoundError in his action, because that's a local problem of
that action.

I think that either:
 - we add something general to handle this (i.e. catch, log and rethrow
errors in coconservlet)
 - or we do nothing at all and assume the user is smart enough to look
somewhat further (i.e. in the tomcat logs).

-- 
Bruno Dumon                             http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
bruno@outerthought.org                          bruno@apache.org


Mime
View raw message