Catch
Wednesday 11th January, 2006 14:27 Comments: 0
I've been looking into Java error catching code, as I'm trying to use JSP to talk to a database using JDBC, and I've finally sorted out a fairly neat way to catch if the database is down, and how to implement transactions (I think). It's been so long since I've played with Java that I feel pretty rusty. While browsing the net, I did come across an article that made me chuckle.
If you are GUI program, now's the time to pop up a modal message box. It doesn't really matter what text you put in it, because the user will ignore it.
A refinement, especially popular with Delphi programmers, is to put up further, identical message boxes at a one half second interval, so that unless the user intervenes and starts closing them at a greater rate, the whole system will eventually die from memory exhaustion.
If you're running under Windows XP, consider converting the exception into a null pointer dereference in the catch handler:
catch(...) { // now we're really stuffed
int * p = 0;
*p = 22;
This has the advantage over an ordinary crash that you will get one of those special OS-supplied dialogs, that asks permission to send log details back to Microsoft. Naive users will interpret this as a Windows fault, and will direct their bile Redmondwards.
Of course, all the above techniques can be combined in fresh and original ways. Never be afraid to experiment.
It is so true though, people always tell me that "Windows crashed" when they mean a badly written application crashed.
If you are GUI program, now's the time to pop up a modal message box. It doesn't really matter what text you put in it, because the user will ignore it.
A refinement, especially popular with Delphi programmers, is to put up further, identical message boxes at a one half second interval, so that unless the user intervenes and starts closing them at a greater rate, the whole system will eventually die from memory exhaustion.
If you're running under Windows XP, consider converting the exception into a null pointer dereference in the catch handler:
catch(...) { // now we're really stuffed
int * p = 0;
*p = 22;
This has the advantage over an ordinary crash that you will get one of those special OS-supplied dialogs, that asks permission to send log details back to Microsoft. Naive users will interpret this as a Windows fault, and will direct their bile Redmondwards.
Of course, all the above techniques can be combined in fresh and original ways. Never be afraid to experiment.
It is so true though, people always tell me that "Windows crashed" when they mean a badly written application crashed.