[java-inspections] IDEA-360135 Non-constant string concatenation in logging call could be triggered with exception argument

GitOrigin-RevId: b9a08671660f1a3cb27e566e1a9ed6a05cd211d4
This commit is contained in:
Mikhail Pyltsin
2024-10-07 13:08:20 +00:00
committed by intellij-monorepo-bot
parent 0a0b47c9d4
commit 77ec6df673
6 changed files with 71 additions and 7 deletions
@@ -0,0 +1,12 @@
import org.slf4j.*;
import java.text.MessageFormat;
class SimpleMessageFormat {
Logger LOG = LoggerFactory.getLogger(SimpleMessageFormat.class);
void f() {
LOG.in<caret>fo("{}, 2 {} {}", 3.0, 2, "1", new Exception());
}
}
@@ -0,0 +1,12 @@
import org.slf4j.*;
import java.text.MessageFormat;
class SimpleMessageFormat {
Logger LOG = LoggerFactory.getLogger(SimpleMessageFormat.class);
void f() {
LOG.in<caret>fo(MessageFormat.format("{2}, 2 {1} {0}", "1", 2, 3.0), new Exception());
}
}
@@ -0,0 +1,12 @@
import org.slf4j.*;
import java.text.MessageFormat;
class SimpleStringFormat {
Logger LOG = LoggerFactory.getLogger(SimpleStringFormat.class);
void f() {
LOG.in<caret>fo("{} something {} {}", "text", true, 1, new RuntimeException());
}
}
@@ -0,0 +1,12 @@
import org.slf4j.*;
import java.text.MessageFormat;
class SimpleStringFormat {
Logger LOG = LoggerFactory.getLogger(SimpleStringFormat.class);
void f() {
LOG.in<caret>fo(String.format("%s something %b %d", "text", true, 1), new RuntimeException());
}
}