I am using SonarQube for my code quality analysis. I am coding in java with the use of AbstractJavaSequence from AdroidLogic API.
Many of my project classes extend this class and override execute method which by default declare throws Exception. The SonarQube analysis raises an issue, stating that the class uses a generic exception instead of specific one.
How can I resolve this SonarQube issue?
Just because the method you are overriding
throws Exception, it doesn't mean you have to.You are free to not declare that you throw any exceptions at all, or to throw specific exceptions instead:
These are all valid (obviously, not all at once):
There's no reason for you to carry on their bad practices.