Fixed McRegionReader not being closed.

Dieser Commit ist enthalten in:
sk89q 2011-03-09 23:55:44 -08:00
Ursprung 1d68fdd11c
Commit 49b4c190f9

Datei anzeigen

@ -48,8 +48,15 @@ public abstract class McRegionChunkStore extends ChunkStore {
protected McRegionReader getReader(Vector2D pos) throws DataException, IOException { protected McRegionReader getReader(Vector2D pos) throws DataException, IOException {
String filename = getFilename(pos); String filename = getFilename(pos);
if (curFilename != null && curFilename.equals(filename)) { if (curFilename != null) {
return cachedReader; if (curFilename.equals(filename)) {
return cachedReader;
} else {
try {
cachedReader.close();
} catch (IOException e) {
}
}
} }
InputStream stream = getInputStream(filename); InputStream stream = getInputStream(filename);
cachedReader = new McRegionReader(stream); cachedReader = new McRegionReader(stream);