OS: Windows 10
IDE: Netbeans 20 with Sonarlint4netbeans 3.0.1 (Uses Sonarlint-core 8.3.0.45095)
LANG: Java 17
Call to method: public void log(Level level, String msg, Throwable thrown) from java.util.logging.Logger class is tagged with “java:S3457” if the given “msg” String is literal and the literal String contains any number of single '-characters.
Below is a reduced Java source code to reproduce this.
import java.lang.logging.Logger;
import java.lang.logging.Level;
public class Tester {
private static final Logger logger = Logger.getLogger(Tester.class.getName());
public static void main(String[] args) {
try {
System.loadLibrary("THIS_LIBRARY_DOES_NOT_EXIST");
} catch(UnsatisfiedLinkError ule) {
logger.log( Level.SEVERE, "Can't load library \"THIS_LIBRARY_DOES_NOT_EXIST\"!", ule );
}
}
}