Skip to content
This repository has been archived by the owner on May 10, 2022. It is now read-only.

fix: release streams resource while loading config #113

Merged
merged 12 commits into from
Jun 28, 2020
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ public static Properties loadConfiguration(String configPath) throws PException
new BufferedInputStream(
new FileInputStream(configPath.substring(PConfigUtil.LOCAL_FILE_PREFIX.length()))));
} else if (PConfigUtil.isResource(configPath)) {
InputStream stream =
try (InputStream stream =
PegasusClient.class.getResourceAsStream(
configPath.substring(PConfigUtil.RESOURCE_PREFIX.length()));
if (stream == null) {
configPath.substring(PConfigUtil.RESOURCE_PREFIX.length()))) {
config.load(stream);
} catch (NullPointerException e) {
neverchanje marked this conversation as resolved.
Show resolved Hide resolved
throw new PException("config resource not found: " + configPath);
}
config.load(stream);
} else {
throw new PException(
"configPath format error, "
Expand Down