Everything, Everything

2024: J F M A M J J A S O N
2023: J F M A M J J A S O N D
2022: J F M A M J J A S O N D
2021: J F M A M J J A S O N D
2020: J F M A M J J A S O N D
2019: J F M A M J J A S O N D
2018: J F M A M J J A S O N D
2017: J F M A M J J A S O N D
2016: J F M A M J J A S O N D
2015: J F M A M J J A S O N D
2014: J F M A M J J A S O N D
2013: J F M A M J J A S O N D
2012: J F M A M J J A S O N D
2011: J F M A M J J A S O N D
2010: J F M A M J J A S O N D
2009: J F M A M J J A S O N D
2008: J F M A M J J A S O N D
2007: J F M A M J J A S O N D
2006: J F M A M J J A S O N D
2005: J F M A M J J A S O N D
2004: J F M A M J J A S O N D
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.
© Robert Nicholls 2002-2024
The views and opinions expressed on this site do not represent the views of my employer.
HTML5 / CSS3