You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[java] GuardLogStatement: False positive when using negative guard conditions #1287
Description:
A short-circuit if statement at the top of the method is not detected by GuardLogStatement and hence a PMD warning shows up on the later log statement.
Code Sample demonstrating the issue:
Problematic code:
private void log()
{
if (!s_logger.isDebugEnabled())
return;
...
s_logger.debug("logging from " + this); // PMD warning shows up here
}
Working code:
private void log()
{
if (s_logger.isDebugEnabled())
{
...
s_logger.debug("logging from " + this); // No PMD warning
}
}
changed the title [-][Java] GuardLogStatement does not understand negative if conditions[/-][+][java] GuardLogStatement does not understand negative if conditions[/+]on Aug 9, 2018
changed the title [-][java] GuardLogStatement does not understand negative if conditions[/-][+][java] GuardLogStatement: False positive when using negative guard conditions[/+]on Jun 9, 2026
Activity
[-][Java] GuardLogStatement does not understand negative if conditions[/-][+][java] GuardLogStatement does not understand negative if conditions[/+][-][java] GuardLogStatement does not understand negative if conditions[/-][+][java] GuardLogStatement: False positive when using negative guard conditions[/+][doc] Update release notes (pmd#1287)
[java] Fix #1287: GuardLogStatement false positive with a guard clause (