From b3c5d67bbd18b7839069bb5b6578754a692eee1b Mon Sep 17 00:00:00 2001 From: Trustin Lee Date: Tue, 5 Aug 2014 11:23:28 -0700 Subject: [PATCH] Fix a bug where ChannelFuture.setFailure(null) doesn't fail Motivation: We forgot to do a null check on the cause parameter of ChannelFuture.setFailure(cause) Modifications: Add a null check Result: Fixed issue: #2728 --- .../main/java/io/netty/util/concurrent/DefaultPromise.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/common/src/main/java/io/netty/util/concurrent/DefaultPromise.java b/common/src/main/java/io/netty/util/concurrent/DefaultPromise.java index 005c0f7d33..cf7c04c0a1 100644 --- a/common/src/main/java/io/netty/util/concurrent/DefaultPromise.java +++ b/common/src/main/java/io/netty/util/concurrent/DefaultPromise.java @@ -471,6 +471,10 @@ public class DefaultPromise extends AbstractFuture implements Promise { } private boolean setFailure0(Throwable cause) { + if (cause == null) { + throw new NullPointerException("cause"); + } + if (isDone()) { return false; }