java - Exception is caught when Exception is not thrown - Stack Overflow
This is a very famous findbug warning,
according to official documentation this kind of warning is generated when
- method uses a try-catch block that catches Exception objects, but Exception is not thrown within the try block.
- sometimes it also is thrown when we use
catch(Exception e)
to catch all types of exceptions at once, it could mask actual programming problems, so findbugs asks you to catch specific exception, so that run-time exceptions can be thrown which indicate programming problems.
for more understanding(and the solution as well) you can have look at the official documentation.
for your case it seems that statements in try
clause do not throw the exception you are handling in catch
clause
Read full article from java - Exception is caught when Exception is not thrown - Stack Overflow
No comments:
Post a Comment