From 74565853bb9a76e177718a9ff73ab45833ea9a0e Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sat, 21 Aug 2021 21:14:37 +0200 Subject: [PATCH] Close Stream Signed-off-by: Lixfel --- .../src/de/steamwar/fightsystem/record/FileSource.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/FightSystem_Main/src/de/steamwar/fightsystem/record/FileSource.java b/FightSystem_Main/src/de/steamwar/fightsystem/record/FileSource.java index 8ecb428..3af2c12 100644 --- a/FightSystem_Main/src/de/steamwar/fightsystem/record/FileSource.java +++ b/FightSystem_Main/src/de/steamwar/fightsystem/record/FileSource.java @@ -22,10 +22,7 @@ package de.steamwar.fightsystem.record; import de.steamwar.fightsystem.Config; import org.bukkit.Bukkit; -import java.io.DataInputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; +import java.io.*; import java.nio.file.Files; import java.nio.file.StandardCopyOption; import java.util.logging.Level; @@ -37,11 +34,13 @@ public class FileSource extends PacketSource { if(Config.replayserver()) return; + InputStream input = de.steamwar.sql.Fight.getReplay(Config.ReplayID); try { Files.copy( - de.steamwar.sql.Fight.getReplay(Config.ReplayID), + input, FileRecorder.getFile().toPath(), StandardCopyOption.REPLACE_EXISTING); + input.close(); new FileSource(FileRecorder.getFile()); } catch (IOException e) { throw new SecurityException("Could not start replay", e);