Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -213,13 +213,8 @@ public static Properties loadProperties(
Properties properties = new Properties();
// add scene judgement in windows environment Fix 2557
if (checkFileNameExist(fileName)) {
try {
FileInputStream input = new FileInputStream(fileName);
try {
properties.load(input);
} finally {
input.close();
}
try (FileInputStream input = new FileInputStream(fileName)) {
properties.load(input);
} catch (Throwable e) {
logger.warn(
COMMON_IO_EXCEPTION,
Expand Down Expand Up @@ -279,19 +274,11 @@ public static Properties loadProperties(
logger.info("load " + fileName + " properties file from " + set);

for (java.net.URL url : set) {
try {
Properties p = new Properties();
InputStream input = url.openStream();
try (InputStream input = url.openStream()) {
if (input != null) {
try {
p.load(input);
properties.putAll(p);
} finally {
try {
input.close();
} catch (Throwable t) {
}
}
Properties p = new Properties();
p.load(input);
properties.putAll(p);
}
} catch (Throwable e) {
logger.warn(
Expand Down Expand Up @@ -331,9 +318,10 @@ public static String loadMigrationRule(Set<ClassLoader> classLoaders, String fil
for (Set<URL> urls : ClassLoaderResourceLoader.loadResources(fileName, classLoadersToLoad)
.values()) {
for (URL url : urls) {
InputStream is = url.openStream();
if (is != null) {
return readString(is);
try (InputStream is = url.openStream()) {
if (is != null) {
return readString(is);
}
}
}
}
Expand Down
Loading