Merge pull request #3347 from adangel:issue-3340-guardlogstatement
[java] NullPointerException applying rule GuardLogStatement #3347
This commit is contained in:
@ -203,7 +203,7 @@ public class GuardLogStatementRule extends AbstractJavaRule implements Rule {
|
||||
}
|
||||
|
||||
private boolean hasArgumentWithMethodCall(ASTPrimarySuffix node) {
|
||||
if (!node.isArguments()) {
|
||||
if (!node.isArguments() || node.getArgumentCount() <= 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -538,6 +538,20 @@ public class Logger {
|
||||
});
|
||||
runTestLambda((s1, s2) -> {LOGGER.debug(s1 + s2);});
|
||||
}
|
||||
}
|
||||
]]></code>
|
||||
</test-code>
|
||||
|
||||
<test-code>
|
||||
<description>NullPointerException applying rule GuardLogStatement (#3340)</description>
|
||||
<expected-problems>0</expected-problems>
|
||||
<code><![CDATA[
|
||||
public class Logger {
|
||||
private static final Logger LOGGER = new Logger();
|
||||
|
||||
public void bar() {
|
||||
LOGGER.debug();
|
||||
}
|
||||
}
|
||||
]]></code>
|
||||
</test-code>
|
||||
|
Reference in New Issue
Block a user