Tuesday, December 29, 2009

Best practices for exception handling in Java

Exception handling is an often ignored area in enterprise software design. It comes out more as an after thought rather than being an integral part of initial design.
I've seen cases where
  • logs are polluted with too many exceptions leading to delay in performing root cause analysis
  • root cause exceptions get eaten up when thrown to upper level stacks and only a generic exception is logged
  • sufficient exception details aren't recorded with the default log levels
Maybe customers should include exception handling use cases, and how well and quickly products allow root cause analysis as part of their POCs. This would lead to vendors spending resources in improving this area of their software.

Also, checkout this excellent article on "Exception management and error tracking in J2EE".