A RetroSearch Logo

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

Search Query:

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

[java] InvalidSlf4jMessageFormat does not handle inline incrementation of arguments · Issue #365 · pmd/pmd · GitHub

Rule Set:
Logging-Java/InvalidSlf4jMessageFormat

Description:

InvalidSlf4jMessageFormat produces false-positives when inline ++value notation is used in arguments of Logger.info method.

This seems to be somehow related to #253, where value is also "calculated".

Code Sample demonstrating the issue:

Logger LOG = LoggerFactory.getLogger(Test.class);
int attempt = 0;
LOG.info("test (attempt #{})", ++attempt);

produces bogus error:

Rule:InvalidSlf4jMessageFormat Priority:5 Missing arguments, expected 1 argument but have 0.

However this:

Logger LOG = LoggerFactory.getLogger(Test.class);
int attempt = 0;
attempt += 1;
LOG.info("test (attempt #{})", attempt);

works fine.

PMD Version: 5.5.6
Running PMD through: Maven


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