forked from phoedos/pmd
Fix NPE on custom exceptions
This commit is contained in:
@ -31,6 +31,11 @@ public class FormalParameterRegexNamingConventionsRule extends AbstractRegexNami
|
||||
|
||||
@Override
|
||||
public Object visit(ASTParameter node, Object data) {
|
||||
// classes that extend Exception will contains methods that have parameters with null names
|
||||
if (node.getImage() == null) {
|
||||
return data;
|
||||
}
|
||||
|
||||
if (node.getModifiers().isFinal()) {
|
||||
checkMatches(FINAL_METHOD_PARAMETER_REGEX, node, data);
|
||||
} else {
|
||||
|
@ -57,4 +57,12 @@ public class Foo {
|
||||
]]></code>
|
||||
</test-code>
|
||||
|
||||
<test-code>
|
||||
<description>ignores null parameter names</description>
|
||||
<expected-problems>0</expected-problems>
|
||||
<code><![CDATA[
|
||||
public with sharing class MyException extends Exception { }
|
||||
]]></code>
|
||||
</test-code>
|
||||
|
||||
</test-data>
|
||||
|
Reference in New Issue
Block a user