Fix DiskOptimisedClipboard not closing

Dieser Commit ist enthalten in:
dordsor21 2020-03-30 17:00:41 +01:00
Ursprung 76efbed4b2
Commit 3cd30ebbff
2 geänderte Dateien mit 5 neuen und 3 gelöschten Zeilen

Datei anzeigen

@ -10,7 +10,6 @@ import com.sk89q.jnbt.IntTag;
import com.sk89q.jnbt.Tag; import com.sk89q.jnbt.Tag;
import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.BaseEntity;
import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.entity.Entity;
import com.sk89q.worldedit.extension.platform.PlatformCommandManager;
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard; import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.regions.CuboidRegion;
@ -99,7 +98,6 @@ public class DiskOptimizedClipboard extends LinearClipboard implements Closeable
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
log.warn("Creating new RandomAccessFile: " + file.getPath());
this.braf = new RandomAccessFile(file, "rw"); this.braf = new RandomAccessFile(file, "rw");
long fileLength = (long) getVolume() * 2L + (long) HEADER_SIZE; long fileLength = (long) getVolume() * 2L + (long) HEADER_SIZE;
braf.setLength(0); braf.setLength(0);
@ -286,7 +284,6 @@ public class DiskOptimizedClipboard extends LinearClipboard implements Closeable
if (byteBuffer != null) { if (byteBuffer != null) {
byteBuffer.force(); byteBuffer.force();
fileChannel.close(); fileChannel.close();
log.warn("Closing the RandomAccessFile: " + file.getPath());
braf.close(); braf.close();
//noinspection ResultOfMethodCallIgnored //noinspection ResultOfMethodCallIgnored
file.setWritable(true); file.setWritable(true);

Datei anzeigen

@ -271,6 +271,11 @@ public class BlockArrayClipboard implements Clipboard {
return parent; return parent;
} }
@Override
public void close() {
this.parent.close();
}
/** /**
* Stores entity data. * Stores entity data.
*/ */