Close file input on exception

This commit is contained in:
snowleo 2011-10-27 00:08:48 +02:00
parent 4b6fc99a62
commit 8200fc2a98

View File

@ -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
{