From 0dd538f9ff77c20da72c4530b3d21633799bc3a5 Mon Sep 17 00:00:00 2001 From: md_5 Date: Wed, 30 Jan 2019 22:05:59 +1100 Subject: [PATCH] #2594: Add second way of catching exceptions when handling UDP query --- .../main/java/net/md_5/bungee/query/QueryHandler.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/query/src/main/java/net/md_5/bungee/query/QueryHandler.java b/query/src/main/java/net/md_5/bungee/query/QueryHandler.java index 79d6886a..9b81197f 100644 --- a/query/src/main/java/net/md_5/bungee/query/QueryHandler.java +++ b/query/src/main/java/net/md_5/bungee/query/QueryHandler.java @@ -50,6 +50,17 @@ public class QueryHandler extends SimpleChannelInboundHandler @Override protected void channelRead0(ChannelHandlerContext ctx, DatagramPacket msg) throws Exception + { + try + { + handleMessage( ctx, msg ); + } catch ( Throwable t ) + { + bungee.getLogger().log( Level.WARNING, "Error whilst handling query packet from " + msg.sender(), t ); + } + } + + private void handleMessage(ChannelHandlerContext ctx, DatagramPacket msg) { ByteBuf in = msg.content(); if ( in.readUnsignedByte() != 0xFE || in.readUnsignedByte() != 0xFD )