geforkt von Mirrors/Paper
[Bleeding] Fixed file handle leak in /timings command. Addresses BUKKIT-853
By: Score_Under <seejay.11@gmail.com>
Dieser Commit ist enthalten in:
Ursprung
9ebb2f13de
Commit
e7c9a43100
@ -53,9 +53,10 @@ public class TimingsCommand extends Command {
|
|||||||
File timings = new File(timingFolder, "timings.txt");
|
File timings = new File(timingFolder, "timings.txt");
|
||||||
File names = null;
|
File names = null;
|
||||||
while (timings.exists()) timings = new File(timingFolder, "timings" + (++index) + ".txt");
|
while (timings.exists()) timings = new File(timingFolder, "timings" + (++index) + ".txt");
|
||||||
|
PrintStream fileTimings = null;
|
||||||
|
PrintStream fileNames = null;
|
||||||
try {
|
try {
|
||||||
PrintStream fileTimings = new PrintStream(timings);
|
fileTimings = new PrintStream(timings);
|
||||||
PrintStream fileNames = null;
|
|
||||||
if (separate) {
|
if (separate) {
|
||||||
names = new File(timingFolder, "names" + index + ".txt");
|
names = new File(timingFolder, "names" + index + ".txt");
|
||||||
fileNames = new PrintStream(names);
|
fileNames = new PrintStream(names);
|
||||||
@ -87,6 +88,13 @@ public class TimingsCommand extends Command {
|
|||||||
sender.sendMessage("Timings written to " + timings.getPath());
|
sender.sendMessage("Timings written to " + timings.getPath());
|
||||||
if (separate) sender.sendMessage("Names written to " + names.getPath());
|
if (separate) sender.sendMessage("Names written to " + names.getPath());
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
} finally {
|
||||||
|
if (fileTimings != null) {
|
||||||
|
fileTimings.close();
|
||||||
|
}
|
||||||
|
if (fileNames != null) {
|
||||||
|
fileNames.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren