From 7d5a03a870f4d5e2ab629eb12c258593119d8845 Mon Sep 17 00:00:00 2001 From: izemlyanskiy <78741933+izemlyanskiy@users.noreply.github.com> Date: Fri, 2 Jul 2021 18:26:34 +0300 Subject: [PATCH] prevent crash on non Linux-based OS on the latest version of netty-incubator-transport-native-io_uring class `IOUring` may throw an exception during initializing. For example on Mac OS Redis connection doesn't work because of this exception https://github.com/netty/netty-incubator-transport-io_uring/blob/main/src/main/java/io/netty/incubator/channel/uring/Native.java#L277 --- src/main/java/io/lettuce/core/resource/IOUringProvider.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/lettuce/core/resource/IOUringProvider.java b/src/main/java/io/lettuce/core/resource/IOUringProvider.java index 781c7c36cf..edb065f1ba 100644 --- a/src/main/java/io/lettuce/core/resource/IOUringProvider.java +++ b/src/main/java/io/lettuce/core/resource/IOUringProvider.java @@ -60,9 +60,9 @@ public class IOUringProvider { try { Class.forName("io.netty.incubator.channel.uring.IOUring"); availability = IOUring.isAvailable(); - } catch (ClassNotFoundException e) { + } catch (ClassNotFoundException | ExceptionInInitializerError e) { availability = false; - } + } IOURING_AVAILABLE = availability;