From 7e0e4c63258b3af6155dfe463d6ea4741ac48dc9 Mon Sep 17 00:00:00 2001 From: Trustin Lee Date: Mon, 10 Feb 2014 11:39:29 -0800 Subject: [PATCH] Fix a bug where DefaultPromise.setUncancellable() returns a wrong value - Fixes #2220 - Its Javadoc says it returns true when the promise is done (but not cancelled) or the promise is uncancellable, but it returns false when the promise is done. --- .../main/java/io/netty/util/concurrent/DefaultPromise.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 e8fc042eb9..2f396d1aac 100644 --- a/common/src/main/java/io/netty/util/concurrent/DefaultPromise.java +++ b/common/src/main/java/io/netty/util/concurrent/DefaultPromise.java @@ -461,14 +461,14 @@ public class DefaultPromise extends AbstractFuture implements Promise { public boolean setUncancellable() { Object result = this.result; if (isDone0(result)) { - return false; + return isCancelled0(result); } synchronized (this) { // Allow only once. result = this.result; if (isDone0(result)) { - return false; + return isCancelled0(result); } this.result = UNCANCELLABLE;