1
0
mirror of https://github.com/GeyserMC/Floodgate.git synced 2025-12-30 20:29:30 +00:00

Forgot to close InputStream

This commit is contained in:
Tim203
2021-01-17 17:32:20 +01:00
parent f17d8c590a
commit 76ae520f2c

View File

@@ -99,18 +99,17 @@ public class DatabaseConfigLoader {
}
// load default config resource
InputStream configStream = classLoader.getResourceAsStream(configFile);
if (configStream == null) {
return null;
}
try (InputStream configStream = classLoader.getResourceAsStream(configFile)) {
if (configStream == null) {
return null;
}
// copy resource and load config
try {
// copy resource and load config
if (!configStream.markSupported()) {
Files.copy(configStream, configPath);
configStream.close();
configStream = classLoader.getResourceAsStream(configFile);
return yaml.loadAs(configStream, configType);
try (InputStream configStream1 = classLoader.getResourceAsStream(configFile)) {
return yaml.loadAs(configStream1, configType);
}
}
configStream.mark(Integer.MAX_VALUE);
@@ -119,7 +118,7 @@ public class DatabaseConfigLoader {
return yaml.loadAs(configStream, configType);
} catch (IOException exception) {
exception.printStackTrace();
return null;
}
return null;
}
}