From 7f0bc7fd24667eeb2fc4593d3a93e7d46c766475 Mon Sep 17 00:00:00 2001 From: Pasqual Koschmieder Date: Sun, 24 Jul 2022 16:08:35 +0200 Subject: [PATCH] don't suppress deserialization issues (#1759) --- .../com/comphenix/protocol/events/PacketContainer.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/comphenix/protocol/events/PacketContainer.java b/src/main/java/com/comphenix/protocol/events/PacketContainer.java index d8ef5c93..761b2d15 100644 --- a/src/main/java/com/comphenix/protocol/events/PacketContainer.java +++ b/src/main/java/com/comphenix/protocol/events/PacketContainer.java @@ -307,7 +307,7 @@ public class PacketContainer extends AbstractStructure implements Serializable { handle = type.getPacketClass() .getConstructor(MinecraftReflection.getPacketDataSerializerClass()) .newInstance(serializer); - } catch (ReflectiveOperationException ex) { + } catch (NoSuchMethodException | IllegalAccessException | InstantiationException ex) { // they might have a static method to create them instead Method method = FuzzyReflection.fromClass(type.getPacketClass(), true) .getMethod(FuzzyMethodContract @@ -318,9 +318,11 @@ public class PacketContainer extends AbstractStructure implements Serializable { .build()); try { handle = method.invoke(null, serializer); - } catch (ReflectiveOperationException ignored) { - throw new RuntimeException("Failed to construct packet for " + type, ex); + } catch (ReflectiveOperationException exception) { + 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 { handle = StructureCache.newPacket(type);