diff --git a/proxy/src/main/java/org/apache/rocketmq/proxy/config/Configuration.java b/proxy/src/main/java/org/apache/rocketmq/proxy/config/Configuration.java index 175ff438f8e..71c244a925d 100644 --- a/proxy/src/main/java/org/apache/rocketmq/proxy/config/Configuration.java +++ b/proxy/src/main/java/org/apache/rocketmq/proxy/config/Configuration.java @@ -51,7 +51,7 @@ public void init() throws Exception { authConfig.setClusterName(proxyConfig.getRocketMQClusterName()); } - public static String loadJsonConfig() throws Exception { + private String loadJsonConfig() throws Exception { String configFileName = ProxyConfig.DEFAULT_CONFIG_FILE_NAME; String filePath = System.getProperty(CONFIG_PATH_PROPERTY); if (StringUtils.isBlank(filePath)) { @@ -67,13 +67,15 @@ public static String loadJsonConfig() throws Exception { File file = new File(filePath); log.info("The current configuration file path is {}", filePath); if (!file.exists()) { - log.warn("the config file {} not exist", filePath); - throw new RuntimeException(String.format("the config file %s not exist", filePath)); + String msg = String.format("the config file %s not exist", filePath); + log.warn(msg); + throw new RuntimeException(msg); } long fileLength = file.length(); if (fileLength <= 0) { - log.warn("the config file {} length is zero", filePath); - throw new RuntimeException(String.format("the config file %s length is zero", filePath)); + String msg = String.format("the config file %s length is zero", filePath); + log.warn(msg); + throw new RuntimeException(msg); } return new String(Files.readAllBytes(file.toPath()), StandardCharsets.UTF_8);