Skip to content

Commit 8ef806e

Browse files
committed
Use AvoidCatchingGenericException
as replacement for AvoidCatchingThrowable. Also enable check for NullPointerExceptions. We don't check for RuntimeException, Exception as we have a couple of instances in PMD's codebase. Also, we don't check for Error, as there is one specific use case in PMD (error recovery during regression testing).
1 parent 7c06bfb commit 8ef806e

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/main/resources/net/sourceforge/pmd/pmd-dogfood-config.xml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,12 @@
190190
</rule>
191191

192192
<!-- <rule ref="category/java/design.xml/AbstractClassWithoutAnyMethod" /> -->
193-
<!-- <rule ref="category/java/design.xml/AvoidCatchingGenericException" /> -->
193+
<rule ref="category/java/errorprone.xml/AvoidCatchingGenericException">
194+
<priority>1</priority>
195+
<properties>
196+
<property name="typesThatShouldNotBeCaught" value="java.lang.NullPointerException,java.lang.Throwable" />
197+
</properties>
198+
</rule>
194199
<!-- <rule ref="category/java/design.xml/AvoidDeeplyNestedIfStmts" /> -->
195200
<!-- <rule ref="category/java/design.xml/AvoidRethrowingException" /> -->
196201
<!-- <rule ref="category/java/design.xml/AvoidThrowingNewInstanceOfSameException" /> -->
@@ -291,10 +296,6 @@
291296
<priority>1</priority>
292297
</rule>
293298
<!-- <rule ref="category/java/errorprone.xml/AvoidCallingFinalize" /> -->
294-
<!-- <rule ref="category/java/errorprone.xml/AvoidCatchingNPE" /> -->
295-
<rule ref="category/java/errorprone.xml/AvoidCatchingThrowable">
296-
<priority>1</priority>
297-
</rule>
298299
<rule ref="category/java/errorprone.xml/AvoidDecimalLiteralsInBigDecimalConstructor">
299300
<priority>1</priority>
300301
</rule>

0 commit comments

Comments
 (0)