Menu

#1504 [java] InvalidSlf4jMessageFormat: False positive with placeholder and exception

PMD-5.5.2
duplicate
nobody
PMD
3-Major
Bug
InvalidSlf4jMessageFormat
2016-08-03
2016-07-08
No

See: https://github.com/pmd/pmd/pull/73#issuecomment-231346287

I'm not sure if this is a correct place to report, but with this change we are getting a lot of false positive
when message contains just one placeholder and we are passing parameter for that placeholder and
exception itself to be logged (which is a valid scenario). So for this statement:

LOG.warn("My message with some placeholder here: {}", valueForPlaceholder, ex);

I'm getting:

PMD Failure: <class name and line here> Rule:InvalidSlf4jMessageFormat Priority:5 Too many arguments, expected 1 argument but have 2.

Discussion

  • Andreas Dangel

    Andreas Dangel - 2016-07-08
    • status: open --> duplicate
     
  • Andreas Dangel

    Andreas Dangel - 2016-07-08

    That's actually a duplicate of [#1500]

     

    Related

    Issues: #1500

  • Andreas Dangel

    Andreas Dangel - 2016-07-08
    • labels: --> java
     
  • Andreas Dangel

    Andreas Dangel - 2016-08-03
    • labels: java --> java, java-logging-java
    • Milestone: New Tickets --> PMD-5.5.2
     

Log in to post a comment.