]> source.dussan.org Git - sonarqube.git/commitdiff
Incorporate the constant property names into the logger format string
authorDaniel Trebbien <dtrebbien@gmail.com>
Mon, 9 Oct 2017 15:52:03 +0000 (10:52 -0500)
committerSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Tue, 10 Oct 2017 12:22:53 +0000 (14:22 +0200)
The resulting string concatenation is still a constant expression.

server/sonar-main/src/main/java/org/sonar/application/config/JdbcSettings.java

index 9011f167c8e4625ed68e0d2550a8e442a5f58f16..dd14b4306a818f7d2bf9cbdd3dd7f424a06ef06a 100644 (file)
@@ -136,19 +136,19 @@ public class JdbcSettings implements Consumer<Props> {
     if (isNotEmpty(existing)) {
       Logger logger = LoggerFactory.getLogger(JdbcSettings.class);
       if (expectedUrl.equals(existing)) {
-        logger.warn("To change H2 database port, only property '{}' should be set (which current value is '{}'). " +
-          "Remove property '{}' from configuration to remove this warning.",
-          JDBC_EMBEDDED_PORT, port,
-          JDBC_URL);
+        logger.warn("To change H2 database port, only property '" + JDBC_EMBEDDED_PORT +
+          "' should be set (which current value is '{}'). " +
+          "Remove property '" + JDBC_URL + "' from configuration to remove this warning.",
+          port);
       } else {
-        logger.warn("Both '{}' and '{}' properties are set. " +
-          "The value of property '{}' ('{}') is not consistent with the value of property '{}' ('{}'). " +
-          "The value of property '{}' will be ignored and value '{}' will be used instead. " +
-          "To remove this warning, either remove property '{}' if your intent was to use the embedded H2 database, otherwise remove property '{}'.",
-          JDBC_EMBEDDED_PORT, JDBC_URL,
-          JDBC_URL, existing, JDBC_EMBEDDED_PORT, port,
-          JDBC_URL, expectedUrl,
-          JDBC_URL, JDBC_EMBEDDED_PORT);
+        logger.warn("Both '" + JDBC_EMBEDDED_PORT + "' and '" + JDBC_URL + "' properties are set. " +
+          "The value of property '" + JDBC_URL + "' ('{}') is not consistent with the value of property '" +
+          JDBC_EMBEDDED_PORT + "' ('{}'). " +
+          "The value of property '" + JDBC_URL + "' will be ignored and value '{}' will be used instead. " +
+          "To remove this warning, either remove property '" + JDBC_URL +
+          "' if your intent was to use the embedded H2 database, otherwise remove property '" + JDBC_EMBEDDED_PORT
+          + "'.",
+          existing, port, expectedUrl);
       }
     }
   }