catch-all exception clause
zhouji2013 opened this issue · 1 comments
It has never turned out that the catch-all exception clause is the proper solution for the problem. It is a very bad idea. When it swallows the exception and does output or log anything, it is worse. In a case in AnalysisListener, it does not swallow the exception, but allows the execution to continue - that is not the right thing to do either.
One of the reasons such handlers exist is that the developers saw 'mysterious' null pointer exceptions and decided that doing nothing is better that crashing the application. I don't think that is right. We need to make a decision in each case, albeit arbitrary to some extent, whether the exception is 'expected' or 'unexpected'. If it is unexpected, we should let the application crash; if it is expected, we should add a null pointer checking and handle it explicitly.