Search code examples
javaapiexceptionweblogicthrowable

good documentation about "avoid catching throwable", in context of weblogic server


I am currently refactoring an existing codebase (EJBs) to rip out all blocks where a Throwable is caught inside of the EJB.

try {
    ... do some business logic
} catch(Throwable t){
    ... log and swallow ... :-(
}

I want/need to convince the people around me with proper documentation that "catching Throwable" is a no-go for an EJB (we have lots of discussions around this). Weblogic will handle all the "Error" conditions and maybe invalidate EJBs and put fresh (working) EJBs into the pool. Catching Throwable would undermine all these security nets provided by weblogic, and catching Throwable is bad practice anyway (but people here are reluctant and use the "Throwable" hammer everywhere).

Is anyone able to point me to some online docs where this behaviour is explained (for weblogic, jboss, etc.). I searched via Google and had a look at the weblogic docs but wasn't able to find anything, just generic java doc.


Solution

  • They say, the proof is in the pudding.

    Write a small example that does nothing but throw different kinds of exceptions ( Runtime, Errors ) and demonstrate that your container gracefully handles them.

    This will stop the critics dead in their tracks.