Skip to content

Commit

Permalink
Issue checkstyle#6606: catch all exceptions during reflection in Abst…
Browse files Browse the repository at this point in the history
…ractTypeAware
  • Loading branch information
rnveach authored and peterdemaeyer committed Apr 27, 2019
1 parent 520978d commit cb0ea16
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
7 changes: 5 additions & 2 deletions config/pmd.xml
Expand Up @@ -206,12 +206,15 @@
<!-- Checker: There is no other way to deliver the filename that was under processing.
See https://github.com/checkstyle/checkstyle/issues/2285
TranslationCheck: It is better to catch all exceptions since it can throw
a runtime exception. -->
a runtime exception.
AbstractTypeAwareCheck: Exception type is not predictable. -->
<property name="violationSuppressXPath"
value="//ClassOrInterfaceDeclaration[@Image='Checker']
//MethodDeclaration[@Name='processFiles']
|//ClassOrInterfaceDeclaration[@Image='TranslationCheck']
//MethodDeclaration[@Name='getTranslationKeys']"/>
//MethodDeclaration[@Name='getTranslationKeys']
|//ClassOrInterfaceDeclaration[@Image='AbstractTypeAwareCheck']
//MethodDeclaration[@Name='resolveClass']"/>
</properties>
</rule>
<rule ref="category/java/design.xml/AvoidDeeplyNestedIfStmts">
Expand Down
Expand Up @@ -240,7 +240,8 @@ protected final Class<?> resolveClass(String resolvableClassName,
try {
clazz = getClassResolver().resolve(resolvableClassName, className);
}
catch (final ClassNotFoundException ignored) {
// -@cs[IllegalCatch] Exception type is not predictable.
catch (final Exception ignored) {
clazz = null;
}
return clazz;
Expand Down

0 comments on commit cb0ea16

Please sign in to comment.