Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions common/src/main/java/org/tron/core/config/Configuration.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ private static void resolveConfigFile(String fileName, File confFile) {
if (confFile.exists()) {
config = ConfigFactory.parseFile(confFile)
.withFallback(ConfigFactory.defaultReference());
} else if (Thread.currentThread().getContextClassLoader().getResourceAsStream(fileName)
} else if (Thread.currentThread().getContextClassLoader().getResource(fileName)
!= null) {
config = ConfigFactory.load(fileName);
} else {
Expand All @@ -59,4 +59,3 @@ private static void resolveConfigFile(String fileName, File confFile) {
}
}
}

11 changes: 4 additions & 7 deletions framework/src/main/java/org/tron/core/config/args/Args.java
Original file line number Diff line number Diff line change
Expand Up @@ -1186,9 +1186,8 @@ public String getOutputDirectory() {
private static void printVersion() {
Properties properties = new Properties();
boolean noGitProperties = true;
try {
InputStream in = Thread.currentThread()
.getContextClassLoader().getResourceAsStream("git.properties");
try (InputStream in = Thread.currentThread()
.getContextClassLoader().getResourceAsStream("git.properties")) {
if (in != null) {
noGitProperties = false;
properties.load(in);
Expand Down Expand Up @@ -1276,9 +1275,8 @@ public static String upperFirst(String name) {

private static String getCommitIdAbbrev() {
Properties properties = new Properties();
try {
InputStream in = Thread.currentThread()
.getContextClassLoader().getResourceAsStream("git.properties");
try (InputStream in = Thread.currentThread()
.getContextClassLoader().getResourceAsStream("git.properties")) {
if (in == null) {
logger.warn("git.properties not found on classpath");
return "";
Expand Down Expand Up @@ -1315,4 +1313,3 @@ private static Map<String, String[]> getOptionGroup() {
return optionGroupMap;
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,14 @@ public static void librustzcashInitZksnarkParams() {
}

private static String getParamsFile(String fileName) {
InputStream in = Thread.currentThread().getContextClassLoader()
.getResourceAsStream("params" + File.separator + fileName);
String resourcePath = "params" + File.separator + fileName;
File fileOut = new File(System.getProperty("java.io.tmpdir")
+ File.separator + fileName + "." + System.currentTimeMillis());
try {
try (InputStream in = Thread.currentThread().getContextClassLoader()
.getResourceAsStream(resourcePath)) {
if (in == null) {
throw new IllegalStateException("Resource not found: " + resourcePath);
}
FileUtils.copyToFile(in, fileOut);
} catch (IOException e) {
logger.error(e.getMessage(), e);
Expand Down
Loading