mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-08-05 12:02:53 +00:00
Close file input on exception
This commit is contained in:
parent
4b6fc99a62
commit
8200fc2a98
1 changed files with 24 additions and 16 deletions
|
@ -33,12 +33,20 @@ public abstract class AbstractFileCommand implements Command
|
|||
throw new IOException("Server log not found.");
|
||||
}
|
||||
final FileInputStream fis = new FileInputStream(logFile);
|
||||
try
|
||||
{
|
||||
if (logFile.length() > 1000000)
|
||||
{
|
||||
fis.skip(logFile.length() - 1000000);
|
||||
}
|
||||
return new BufferedReader(new InputStreamReader(fis));
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
fis.close();
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
protected BufferedReader getPluginConfig(final String pluginName, final String fileName) throws IOException
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue