| Author |
Tool to identify problems in catch blocks
|
Prince Manchanda
Ranch Hand
Joined: Jun 25, 2001
Posts: 45
|
|
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
Bartender
Joined: Aug 22, 2010
Posts: 2379
|
|
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
|
|
|