Yep. If theres one thing I hate its spending hours on a friday night tracing through some other developers code to find why something in the api they expose doesnt work and eventually coming to:

catch(Throwable t)
{
  return null;
}

deep in the bowels of it.... and knowing that I cant even fix it without breaking all the other stuff that others have written that now depend on this behaviour....


garrgh!

Yee, Richard K, CTR,, DMDCWEST wrote:
Dan,
Thanks for sharing your pain. You should check out Jalopy on SourceForge. It
is a code formatter and code inspector. It allows you to format your java
code according to your organization's conventions and also inspect it for
some of the items in Joshua Bloch's Effective Java book. The code inspector
capability includes detecting empty catch and finally clauses. There are
integrations with several IDE's and Ant. We use Jalopy to format and catch
bad programming practices and integrate it as part of the build process.

Regards,

Richard


-----Original Message-----
From: Dan Allen [mailto:[EMAIL PROTECTED] Sent: Thursday, September 02, 2004 10:46 AM
To: Struts Users Mailing List
Subject: never, ever bury an exception!



I know that this might be obvious, but I am telling you all just so that you can learn from my pain. Because of time pressure, I accidently left an caught exception in the following state:

catch (Exception e)
{
  // TODO: do something with me
}

For the last couple of days the application server has been coming crashing
down.  The problem was that this particular exception was being thrown as
the result of a StackOverflow error.  When the exception was silenced, the
execution would go back around and throw the StackOverflow error again
inside a loop.  Eventually, memory would become expended and the app server
would die.  But because the error is totally silenced, no reason is given
for the crash because the app server didn't receive any messages.

At the very, very least, log the error.  That will give you an inkling of an
idea as to where the server might be dying.  Even if there is no way you
think that the code you wrote would lead to a StackOverflow (or some other
accumulating problem), do it anyway.  Point is, you are better safe then
sorry.  I am an idiot for leaving that exception in that state, but at least
I learned my lesson.

Dan



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



Reply via email to