31 lines
760 B
Plaintext
31 lines
760 B
Plaintext
Different formatters use different formatting symbols, and it can be easy to confuse one for the other. But get it wrong, and your output may be useless.
|
|
|
|
|
|
This rule logs an issue when the wrong type of format string is used for Guava, slf4j, logback or ``++MessageFormat++`` strings.
|
|
|
|
|
|
== Noncompliant Code Example
|
|
|
|
[source,java]
|
|
----
|
|
String message = MessageFormat.format("Now is the %s %d all good people", "time", 4); // Noncompliant
|
|
----
|
|
|
|
|
|
== Compliant Solution
|
|
|
|
[source,java]
|
|
----
|
|
String message = MessageFormat.format("Now is the {1} {2} all good people", "time", 4); // Noncompliant
|
|
----
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
include::message.adoc[]
|
|
|
|
endif::env-github,rspecator-view[]
|