Menu

#1398 False positive for GuardLogStatementJavaUtil with Log4j

PMD-5.3.4
closed
None
PMD
3-Major
Bug
5.3.3
java-logging-java/GuardLogStatementJavaUtil
2015-09-06
2015-08-31
Rei Angelus
No

PMD detects a false positive GuardLogStatementJavaUtil with the code below :

    <test-code>
        <description>False positive for GuardLogStatementJavaUtil with Log4j</description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
import org.apache.log4j.Logger;

public class GuardLogTest {
    Logger LOG;
    public void foo() {
        if (LOG.isInfoEnabled()) {
            LOG.info("update: After spool map size: " + map.size());
        }
    }
}
        ]]></code>
    </test-code>

Thanks,

Discussion

  • Andreas Dangel

    Andreas Dangel - 2015-09-06
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,7 +1,7 @@
     PMD detects a false positive GuardLogStatementJavaUtil with the code below :
    
    -:::java
    -
    +~~~~~
    +:::xml
         <test-code>
             <description>False positive for GuardLogStatementJavaUtil with Log4j</description>
             <expected-problems>0</expected-problems>
    @@ -18,5 +18,6 @@
     }
             ]]></code>
         </test-code>
    +~~~~~
    
     Thanks,
    
    • status: open --> closed
    • assigned_to: Andreas Dangel
    • Milestone: New Tickets --> PMD-5.3.4
    • Ruleset / Rule: --> java-logging-java/GuardLogStatementJavaUtil
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.