mirror of
https://github.com/EngineHub/WorldEdit.git
synced 2024-12-27 05:00:08 +08:00
Clean up some io close() calls
This commit is contained in:
parent
9637871969
commit
1fef255d77
@ -69,11 +69,11 @@ public static boolean filesExists() {
|
||||
public Map<String, Set<String>> loadGroupPermissions() {
|
||||
Map<String, Set<String>> userGroupPermissions = new HashMap<String, Set<String>>();
|
||||
|
||||
FileReader input = null;
|
||||
BufferedReader buff = null;
|
||||
|
||||
try {
|
||||
input = new FileReader(this.groupFile);
|
||||
BufferedReader buff = new BufferedReader(input);
|
||||
FileReader input = new FileReader(this.groupFile);
|
||||
buff = new BufferedReader(input);
|
||||
|
||||
String line;
|
||||
while ((line = buff.readLine()) != null) {
|
||||
@ -101,8 +101,8 @@ public Map<String, Set<String>> loadGroupPermissions() {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
try {
|
||||
if (input != null) {
|
||||
input.close();
|
||||
if (buff != null) {
|
||||
buff.close();
|
||||
}
|
||||
} catch (IOException e2) {
|
||||
}
|
||||
@ -122,11 +122,11 @@ public void load() {
|
||||
defaultPermissionsCache = userGroupPermissions.get("default");
|
||||
}
|
||||
|
||||
FileReader input = null;
|
||||
BufferedReader buff = null;
|
||||
|
||||
try {
|
||||
input = new FileReader(this.userFile);
|
||||
BufferedReader buff = new BufferedReader(input);
|
||||
FileReader input = new FileReader(this.userFile);
|
||||
buff = new BufferedReader(input);
|
||||
|
||||
String line;
|
||||
while ((line = buff.readLine()) != null) {
|
||||
@ -166,8 +166,8 @@ public void load() {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
try {
|
||||
if (input != null) {
|
||||
input.close();
|
||||
if (buff != null) {
|
||||
buff.close();
|
||||
}
|
||||
} catch (IOException e2) {
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ public CompoundTag getChunkTag(Vector2D pos, LocalWorld world)
|
||||
|
||||
return rootTag;
|
||||
} finally {
|
||||
stream.close();
|
||||
nbt.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -104,7 +104,7 @@ public CompoundTag getChunkTag(Vector2D pos, LocalWorld world) throws DataExcept
|
||||
|
||||
return rootTag;
|
||||
} finally {
|
||||
stream.close();
|
||||
nbt.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -68,6 +68,7 @@ public CuboidClipboard load(File file) throws IOException, DataException {
|
||||
|
||||
// Schematic tag
|
||||
CompoundTag schematicTag = (CompoundTag) nbtStream.readTag();
|
||||
nbtStream.close();
|
||||
if (!schematicTag.getName().equals("Schematic")) {
|
||||
throw new DataException("Tag \"Schematic\" does not exist or is not first");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user