mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-23 05:36:46 +01:00
Fix resource leak on exception
When an exception is hit in the try statement, the readers will never get closed and leak resources
This commit is contained in:
parent
877ef15374
commit
69a4ec80cd
@ -54,15 +54,15 @@ public class WorldBlacklist {
|
|||||||
if(!blacklist.contains(currentLine))
|
if(!blacklist.contains(currentLine))
|
||||||
blacklist.add(currentLine);
|
blacklist.add(currentLine);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Close readers
|
|
||||||
bufferedReader.close();
|
|
||||||
fileReader.close();
|
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} catch (IOException e)
|
} catch (IOException e)
|
||||||
{
|
{
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
} finally {
|
||||||
|
//Close readers
|
||||||
|
if(bufferedReader != null) bufferedReader.close();
|
||||||
|
if(fileReader != null) fileReader.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
plugin.getLogger().info(blacklist.size()+" entries in mcMMO World Blacklist");
|
plugin.getLogger().info(blacklist.size()+" entries in mcMMO World Blacklist");
|
||||||
|
Loading…
Reference in New Issue
Block a user