Log4j2 false positive

When using the Log4j2 API java:S2275 triggers a false positive if the last argument is a Throwable.


import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
  private static final Logger LOGGER = LogManager.getLogger(MyClass.class);
String param1 = "hello";
String param2 = "world";
Throwable param3 = new RuntimeException();
LOGGER.info("This is a comment with {} {} {} three parameters.", param1, param2, param3);

SonarQube Version 8.3.1 (build 34397)

Welcome! :slight_smile:

Thank you for the bug report, I’ve been able to reproduce the bug with your code and have created a ticket for the issue: https://jira.sonarsource.com/browse/SONARJAVA-3418

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.