From d0c2f6e8b3c91dcc018d2029d2cab8e21460fb09 Mon Sep 17 00:00:00 2001 From: Norman Maurer Date: Wed, 22 Apr 2020 08:07:27 +0200 Subject: [PATCH] Clarify exception message when ALPN is not supported (#10155) Motivation: We should provide more informations when ALPN is not supported and a user tries to use it. Modifications: - Use UnsupportedOperationException Result: Easier to debug ALPN problems --- .../handler/ssl/JdkAlpnApplicationProtocolNegotiator.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/handler/src/main/java/io/netty/handler/ssl/JdkAlpnApplicationProtocolNegotiator.java b/handler/src/main/java/io/netty/handler/ssl/JdkAlpnApplicationProtocolNegotiator.java index eb4a494afe..c4ca7b9b8c 100644 --- a/handler/src/main/java/io/netty/handler/ssl/JdkAlpnApplicationProtocolNegotiator.java +++ b/handler/src/main/java/io/netty/handler/ssl/JdkAlpnApplicationProtocolNegotiator.java @@ -144,7 +144,8 @@ public final class JdkAlpnApplicationProtocolNegotiator extends JdkBaseApplicati return isServer ? JettyAlpnSslEngine.newServerEngine(engine, applicationNegotiator) : JettyAlpnSslEngine.newClientEngine(engine, applicationNegotiator); } - throw new RuntimeException("Unable to wrap SSLEngine of type " + engine.getClass().getName()); + throw new UnsupportedOperationException("ALPN not supported. Unable to wrap SSLEngine of type '" + + engine.getClass().getName() + "')"); } }