A small word of caution for Java Web Developers
A small word of caution to java web developers who might make what appears to be very silly yet very hard-to-resist-from-making-this-mistake. In my 8 years of career as a Software professional and of course, as a teacher, I've seen this happen more often among once-my-colleagues in Corporates than my UG and PG students.
Consider the following block of code snippets....
The code originates from what those professional used to study as text books when they had been in Colleges...an approach of handling exceptions which I think is totally an elusive approach.
The code, to some extent works for console oriented works.
But what if it is deployed on a Web Container? Despite variation in Application Server strategies, most likely the code is going to terminate the Application Server Instance by terminating the VM should an Exception or Error occur.
My advice to all professionals is, hence, to keep an eye on how strongly you handle java.lang.Throwable and let the end user know what happened to the system and not terminate the VM in any case.