1
0
mirror of https://github.com/essentials/Essentials.git synced 2025-08-14 02:24:16 +02:00

Close file input on exception

This commit is contained in:
snowleo
2011-10-27 00:08:48 +02:00
parent 1de5cb6dbd
commit 569f813428

View File

@@ -33,12 +33,20 @@ public abstract class AbstractFileCommand implements Command
throw new IOException("Server log not found."); throw new IOException("Server log not found.");
} }
final FileInputStream fis = new FileInputStream(logFile); final FileInputStream fis = new FileInputStream(logFile);
try
{
if (logFile.length() > 1000000) if (logFile.length() > 1000000)
{ {
fis.skip(logFile.length() - 1000000); fis.skip(logFile.length() - 1000000);
} }
return new BufferedReader(new InputStreamReader(fis)); return new BufferedReader(new InputStreamReader(fis));
} }
catch (IOException ex)
{
fis.close();
throw ex;
}
}
protected BufferedReader getPluginConfig(final String pluginName, final String fileName) throws IOException protected BufferedReader getPluginConfig(final String pluginName, final String fileName) throws IOException
{ {