aspose file tools*
The moose likes IDEs, Version Control and other tools and the fly likes Tool to identify problems in catch blocks Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "Tool to identify problems in catch blocks" Watch "Tool to identify problems in catch blocks" New topic
Author

Tool to identify problems in catch blocks

Prince Manchanda
Ranch Hand

Joined: Jun 25, 2001
Posts: 52
I am looking for a tool (may be build time or eclipse plugin) that can help me to identify if I am not logging the Exception trace/message.

We have a legacy application that has try catch block in which a custom error message is logged. The exception is not logged and is not thrown. So, when a problem occurs, there is no stack trace in the log files that would help to debug the issue. An example of this is:



i need a tool like Coverity or Checkstyle that can help me to identify all such occurrences in my code base.


Thanks and Regards
P Manchanda
Martin Vajsar
Sheriff

Joined: Aug 22, 2010
Posts: 3610
    
  60

It looks like FindBugs can warn you if an exception is "dropped": see this. There might be other static code analysis tools that would warn you about the same.

It probably won't warn you if it is not properly logged, though. That should not be so much of a problem, you should log exceptions at the topmost level of your program, and probably install an uncaught exception handler to log those that might otherwise be missed. (You might need to setup a Swing-specific uncaught exception handler if you're using Swing.) These places should be few and thus relatively easy to review.

If you're logging and dropping an exception at a lot of places in code, this won't help you. Such a design would look very suspicious to me, though.
 
 
subject: Tool to identify problems in catch blocks