From c78c3bead05477fd185da3b60b414e213a3827f2 Mon Sep 17 00:00:00 2001 From: skyguard1 Date: Thu, 16 Jul 2020 16:54:50 +0800 Subject: [PATCH] Add default handling for switch statement (#10408) Motivation: When a switch statement is used we should always define a `default:` so we don't introduce bugs due fall-through. Modification: Add missing `default:`s Result: Less error-prone code --- .../src/main/java/io/netty/util/internal/PlatformDependent.java | 2 ++ transport/src/main/java/io/netty/channel/nio/NioHandler.java | 2 ++ 2 files changed, 4 insertions(+) diff --git a/common/src/main/java/io/netty/util/internal/PlatformDependent.java b/common/src/main/java/io/netty/util/internal/PlatformDependent.java index 1d95d954be..1996813a05 100644 --- a/common/src/main/java/io/netty/util/internal/PlatformDependent.java +++ b/common/src/main/java/io/netty/util/internal/PlatformDependent.java @@ -1055,6 +1055,8 @@ public final class PlatformDependent { case 'g': case 'G': maxDirectMemory *= 1024 * 1024 * 1024; break; + default: + break; } break; } diff --git a/transport/src/main/java/io/netty/channel/nio/NioHandler.java b/transport/src/main/java/io/netty/channel/nio/NioHandler.java index 520d8a3d11..6577cbecd8 100644 --- a/transport/src/main/java/io/netty/channel/nio/NioHandler.java +++ b/transport/src/main/java/io/netty/channel/nio/NioHandler.java @@ -625,6 +625,8 @@ public final class NioHandler implements IoHandler { invokeChannelUnregistered(task, k, null); } break; + default: + break; } } }