1
0
mirror of https://github.com/GeyserMC/Geyser.git synced 2025-12-28 19:29:14 +00:00

Close locale streams (#1832)

* Close locale streams

* Fix formatting
This commit is contained in:
Extollite
2021-01-12 21:06:48 +01:00
committed by GitHub
parent af405f320a
commit dd0b4bafe8
2 changed files with 8 additions and 2 deletions

View File

@@ -217,8 +217,8 @@ public class FileUtils {
* @return The byte array of the file
*/
public static byte[] readAllBytes(File file) {
try {
return readAllBytes(new FileInputStream(file));
try (InputStream inputStream = new FileInputStream(file)) {
return readAllBytes(inputStream);
} catch (IOException e) {
throw new RuntimeException("Cannot read " + file);
}

View File

@@ -208,6 +208,12 @@ public class LocaleUtils {
// Insert the locale into the mappings
LOCALE_MAPPINGS.put(locale.toLowerCase(), langMap);
try {
localeStream.close();
} catch (IOException e) {
throw new AssertionError(LanguageUtils.getLocaleStringLog("geyser.locale.fail.file", locale, e.getMessage()));
}
} else {
GeyserConnector.getInstance().getLogger().warning(LanguageUtils.getLocaleStringLog("geyser.locale.fail.missing", locale));
}