Skip to content

Commit 30e739b

Browse files
author
huzhenyuan
committed
fix bug: resolve config file in jar using getResourceAsStream
1 parent 827869f commit 30e739b

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/main/java/org/tron/core/config/Configuration.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,10 @@ public static com.typesafe.config.Config getByFileName(final String shellConfFil
5959
private static void resolveConfigFile(String fileName, File confFile) {
6060
if (confFile.exists()) {
6161
config = ConfigFactory.parseFile(confFile);
62-
} else {
63-
try {
64-
ResourceUtils.getFile("classpath:" + fileName);
65-
} catch (FileNotFoundException e) {
66-
throw new IllegalArgumentException("Configuration path is required! No Such file " + fileName);
67-
}
62+
} else if (Thread.currentThread().getContextClassLoader().getResourceAsStream(fileName) != null) {
6863
config = ConfigFactory.load(fileName);
64+
} else {
65+
throw new IllegalArgumentException("Configuration path is required! No Such file " + fileName);
6966
}
7067
}
7168
}

0 commit comments

Comments
 (0)