mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-01-19 08:55:26 +01:00
Handle EOFException in Chunklets by returning a new empty ChunkletStore and printing an error.
This commit is contained in:
parent
12a7d794b4
commit
39c2c5f25f
@ -1,5 +1,6 @@
|
|||||||
package com.gmail.nossr50.util.blockmeta;
|
package com.gmail.nossr50.util.blockmeta;
|
||||||
|
|
||||||
|
import java.io.EOFException;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
@ -12,6 +13,8 @@ import org.bukkit.Bukkit;
|
|||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
|
|
||||||
public class HashChunkletManager implements ChunkletManager {
|
public class HashChunkletManager implements ChunkletManager {
|
||||||
private HashMap<String, ChunkletStore> store = new HashMap<String, ChunkletStore>();
|
private HashMap<String, ChunkletStore> store = new HashMap<String, ChunkletStore>();
|
||||||
|
|
||||||
@ -211,6 +214,11 @@ public class HashChunkletManager implements ChunkletManager {
|
|||||||
objIn.close();
|
objIn.close();
|
||||||
fileIn.close();
|
fileIn.close();
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
|
if (ex instanceof EOFException) {
|
||||||
|
// EOF should only happen on Chunklets that somehow have been corrupted.
|
||||||
|
mcMMO.p.getLogger().severe("Chunklet data at " + location.toString() + " could not be read, data in this are will be lost.");
|
||||||
|
return ChunkletStoreFactory.getChunkletStore();
|
||||||
|
}
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
} catch (ClassNotFoundException ex) {
|
} catch (ClassNotFoundException ex) {
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user