Skip to content

Commit dff3117

Browse files
committed
Better error-handling when loading corrupted entity-chunks
1 parent 03ac098 commit dff3117

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

core/src/main/java/de/bluecolored/bluemap/core/world/mca/chunk/MCAChunkLoader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public MCAChunk load(MCAWorld world, InputStream in) throws IOException {
111111
D data = MCAUtil.BLUENBT.read(in, dataType);
112112
return mightSupport(data.getDataVersion()) ? constructor.apply(world, data) : new MCAChunk(world, data) {};
113113
} catch (Exception e) {
114-
throw new IOException("Failed to parse chunk-data: " + e, e);
114+
throw new IOException("Failed to parse chunk-data (%s): %s".formatted(dataType.getSimpleName(), e), e);
115115
}
116116
}
117117

core/src/main/java/de/bluecolored/bluemap/core/world/mca/entity/chunk/MCAEntityChunkLoader.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,11 @@ public MCAEntityChunk load(byte[] data, int offset, int length, Compression comp
4040
InputStream in = new ByteArrayInputStream(data, offset, length);
4141
InputStream decompressedIn = compression.decompress(in)
4242
) {
43-
return MCAUtil.BLUENBT.read(decompressedIn, MCAEntityChunk.class);
43+
try {
44+
return MCAUtil.BLUENBT.read(decompressedIn, MCAEntityChunk.class);
45+
} catch (Exception e) {
46+
throw new IOException("Failed to parse chunk-data (%s): %s".formatted(MCAEntityChunk.class.getSimpleName(), e), e);
47+
}
4448
}
4549
}
4650

0 commit comments

Comments
 (0)