mirror of
https://github.com/dmulloy2/ProtocolLib.git
synced 2024-11-27 13:15:52 +01:00
don't suppress deserialization issues (#1759)
This commit is contained in:
parent
96155b1065
commit
7f0bc7fd24
@ -307,7 +307,7 @@ public class PacketContainer extends AbstractStructure implements Serializable {
|
|||||||
handle = type.getPacketClass()
|
handle = type.getPacketClass()
|
||||||
.getConstructor(MinecraftReflection.getPacketDataSerializerClass())
|
.getConstructor(MinecraftReflection.getPacketDataSerializerClass())
|
||||||
.newInstance(serializer);
|
.newInstance(serializer);
|
||||||
} catch (ReflectiveOperationException ex) {
|
} catch (NoSuchMethodException | IllegalAccessException | InstantiationException ex) {
|
||||||
// they might have a static method to create them instead
|
// they might have a static method to create them instead
|
||||||
Method method = FuzzyReflection.fromClass(type.getPacketClass(), true)
|
Method method = FuzzyReflection.fromClass(type.getPacketClass(), true)
|
||||||
.getMethod(FuzzyMethodContract
|
.getMethod(FuzzyMethodContract
|
||||||
@ -318,9 +318,11 @@ public class PacketContainer extends AbstractStructure implements Serializable {
|
|||||||
.build());
|
.build());
|
||||||
try {
|
try {
|
||||||
handle = method.invoke(null, serializer);
|
handle = method.invoke(null, serializer);
|
||||||
} catch (ReflectiveOperationException ignored) {
|
} catch (ReflectiveOperationException exception) {
|
||||||
throw new RuntimeException("Failed to construct packet for " + type, ex);
|
throw new RuntimeException("Failed to construct packet for " + type, exception);
|
||||||
}
|
}
|
||||||
|
} catch (InvocationTargetException ex) {
|
||||||
|
throw new RuntimeException("Unable to clone packet " + type + " using constructor", ex.getCause());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
handle = StructureCache.newPacket(type);
|
handle = StructureCache.newPacket(type);
|
||||||
|
Loading…
Reference in New Issue
Block a user