Skip to content

Commit 500c468

Browse files
authored
[ISSUE #9978] Remove static from loadJsonConfig and unify exception strings (#9979)
1 parent b6cc188 commit 500c468

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

proxy/src/main/java/org/apache/rocketmq/proxy/config/Configuration.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public void init() throws Exception {
5151
authConfig.setClusterName(proxyConfig.getRocketMQClusterName());
5252
}
5353

54-
public static String loadJsonConfig() throws Exception {
54+
private String loadJsonConfig() throws Exception {
5555
String configFileName = ProxyConfig.DEFAULT_CONFIG_FILE_NAME;
5656
String filePath = System.getProperty(CONFIG_PATH_PROPERTY);
5757
if (StringUtils.isBlank(filePath)) {
@@ -67,13 +67,15 @@ public static String loadJsonConfig() throws Exception {
6767
File file = new File(filePath);
6868
log.info("The current configuration file path is {}", filePath);
6969
if (!file.exists()) {
70-
log.warn("the config file {} not exist", filePath);
71-
throw new RuntimeException(String.format("the config file %s not exist", filePath));
70+
String msg = String.format("the config file %s not exist", filePath);
71+
log.warn(msg);
72+
throw new RuntimeException(msg);
7273
}
7374
long fileLength = file.length();
7475
if (fileLength <= 0) {
75-
log.warn("the config file {} length is zero", filePath);
76-
throw new RuntimeException(String.format("the config file %s length is zero", filePath));
76+
String msg = String.format("the config file %s length is zero", filePath);
77+
log.warn(msg);
78+
throw new RuntimeException(msg);
7779
}
7880

7981
return new String(Files.readAllBytes(file.toPath()), StandardCharsets.UTF_8);

0 commit comments

Comments
 (0)