Yes, that's great! There are some minor glitches in your sample code; here is a slightly modified version:
<module name="IllegalThrows"> <property name="severity" value="warning"/> <property name="illegalClassNames" value="java.lang.NullPointerException,java.lang.RuntimeException"/> </module> <module name="IllegalThrows"> <property name="severity" value="error"/> <property name="illegalClassNames" value="java.lang.Exception"/> </module>
I set a severity for both modules. You can leave it if it matches the default severity (usually warning ). In addition, I removed the redundancy when an Exception was declared in both modules. This will cause you to get two problems for the same line of code. It is enough to specify only full class names.
source share