A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pmd/pmd/issues/3146 below:

[java] InvalidLogMessageFormat detection failing when String.format used · Issue #3146 · pmd/pmd · GitHub

New in 6.32, did not occur in 6.31

Make sure, to test with the latest PMD version.

Description:

The InvalidLogMessageFormat is incorrectly flagging logging statements for having the wrong number of arguments when String.format is used inline to build the msg parameter.

Exception Stacktrace:

Missing arguments, expected 1 argument but have 0.

Check for messages in slf4j and log4j2 (since 6.19.0) loggers with non matching number of arguments and placeholders.

Code Sample demonstrating the issue:

LOGGER.info(String.format("Skipping file %s because no parser could be found", entry.getName()));

Steps to reproduce:

Please provide detailed steps for how we can reproduce the bug.

Run mvn pmd:pmd to generate the false flag

Running PMD through: [CLI | Ant | Maven | Gradle | Designer | Other]

Java 8
Maven 3.5


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4