FP on squid:S3457 when using marker

java
false-positive

(Franz van Betteraey) #1

Description
When using slf4j logging statements with a marker a FP occures when the logging message has no arguments.

Versions

  • SonarQube: 7.2
  • Sonar Java 5.8

Example code to reproduce behaviour:

package foo.bar;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.Marker;
import org.slf4j.MarkerFactory;

public class Main {

    public static final Logger LOGGER = LoggerFactory.getLogger(Main.class);
    
    static void logMarker() {
        Marker marker = MarkerFactory.getMarker("FooBar");
        LOGGER.debug(marker, "A message with Marker");  // FP on squid:S3457 here
    }
}