1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
--- ../work/decompile-8eb82bde//net/minecraft/server/NBTTagList.java 2015-04-16 22:50:27.960251957 +0100
+++ src/main/java/net/minecraft/server/NBTTagList.java 2015-04-16 22:50:27.960251957 +0100
@@ -3,6 +3,7 @@
import com.google.common.collect.Lists;
import java.io.DataInput;
import java.io.DataOutput;
+import java.io.IOException;
import java.util.Iterator;
import java.util.List;
import org.apache.logging.log4j.LogManager;
@@ -23,8 +24,10 @@
this.type = 0;
}
+ try { // CraftBukkit
dataoutput.writeByte(this.type);
dataoutput.writeInt(this.list.size());
+ } catch (Throwable t) { sneakyThrow(t); } // CraftBukkit
for (int i = 0; i < this.list.size(); ++i) {
((NBTBase) this.list.get(i)).write(dataoutput);
@@ -33,12 +36,14 @@
}
void load(DataInput datainput, int i, NBTReadLimiter nbtreadlimiter) {
+ try { // CraftBukkit
if (i > 512) {
throw new RuntimeException("Tried to read NBT tag with too high complexity, depth > 512");
} else {
nbtreadlimiter.a(8L);
this.type = datainput.readByte();
int j = datainput.readInt();
+ nbtreadlimiter.a(j * 8); // CraftBukkit
this.list = Lists.newArrayList();
@@ -50,6 +55,7 @@
}
}
+ } catch (Throwable t) { sneakyThrow(t); } // CraftBukkit
}
public byte getTypeId() {
@@ -196,4 +202,14 @@
public int f() {
return this.type;
}
+
+ // CraftBukkit start
+ public static void sneakyThrow(Throwable ex) {
+ NBTTagList.<RuntimeException>sneakyThrowInner(ex);
+ }
+
+ public static <T extends Throwable> T sneakyThrowInner(Throwable ex) throws T {
+ throw (T) ex;
+ }
+ // CraftBukkit end
}
|