From 6972869252c7be41fb0230d9f5a8c3aa8b12c95e Mon Sep 17 00:00:00 2001 From: Daniel Trebbien Date: Mon, 9 Oct 2017 10:52:03 -0500 Subject: [PATCH] Incorporate the constant property names into the logger format string The resulting string concatenation is still a constant expression. --- .../application/config/JdbcSettings.java | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/server/sonar-main/src/main/java/org/sonar/application/config/JdbcSettings.java b/server/sonar-main/src/main/java/org/sonar/application/config/JdbcSettings.java index 9011f167c8e..dd14b4306a8 100644 --- a/server/sonar-main/src/main/java/org/sonar/application/config/JdbcSettings.java +++ b/server/sonar-main/src/main/java/org/sonar/application/config/JdbcSettings.java @@ -136,19 +136,19 @@ public class JdbcSettings implements Consumer { 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); } } } -- 2.39.5