mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-09-07 12:58:02 +02:00
Close file opened for reading blueprint before delete.
https://github.com/BentoBoxWorld/BentoBox/issues/687
This commit is contained in:
parent
b2a6396cf8
commit
cf0b2ccdd5
@ -98,7 +98,10 @@ public class BlueprintClipboardManager {
|
||||
plugin.logError(LOAD_ERROR + file.getName());
|
||||
throw new IOException(LOAD_ERROR + file.getName() + " temp file");
|
||||
}
|
||||
Blueprint bp = gson.fromJson(new FileReader(file), Blueprint.class);
|
||||
Blueprint bp;
|
||||
try (FileReader fr = new FileReader(file)) {
|
||||
bp = gson.fromJson(fr, Blueprint.class);
|
||||
}
|
||||
Files.delete(file.toPath());
|
||||
return bp;
|
||||
}
|
||||
@ -204,11 +207,11 @@ public class BlueprintClipboardManager {
|
||||
while((length = inputStream.read(buffer)) >= 0) {
|
||||
zipOutputStream.write(buffer, 0, length);
|
||||
}
|
||||
try {
|
||||
Files.delete(targetFile.toPath());
|
||||
} catch (Exception e) {
|
||||
plugin.logError(e.getMessage());
|
||||
}
|
||||
}
|
||||
try {
|
||||
Files.delete(targetFile.toPath());
|
||||
} catch (Exception e) {
|
||||
plugin.logError(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user