From 4eff91df99a5ab0f443a7beab2cf4b2f0e25d6ff Mon Sep 17 00:00:00 2001 From: Trustin Lee Date: Wed, 13 Feb 2013 22:53:10 -0800 Subject: [PATCH] Fix a bug where DefaultChannelPromise.failure0() always returns false / Revert a bad commit --- .../java/io/netty/channel/DefaultChannelHandlerContext.java | 2 +- .../src/main/java/io/netty/channel/DefaultChannelPromise.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/transport/src/main/java/io/netty/channel/DefaultChannelHandlerContext.java b/transport/src/main/java/io/netty/channel/DefaultChannelHandlerContext.java index 0e07feddd8..d63d4df7c8 100755 --- a/transport/src/main/java/io/netty/channel/DefaultChannelHandlerContext.java +++ b/transport/src/main/java/io/netty/channel/DefaultChannelHandlerContext.java @@ -1295,7 +1295,7 @@ final class DefaultChannelHandlerContext extends DefaultAttributeMap implements private void invokeFlush0(ChannelPromise promise) { Channel channel = channel(); if (!channel.isRegistered() && !channel.isActive()) { - promise.tryFailure(new ClosedChannelException()); + promise.setFailure(new ClosedChannelException()); return; } diff --git a/transport/src/main/java/io/netty/channel/DefaultChannelPromise.java b/transport/src/main/java/io/netty/channel/DefaultChannelPromise.java index fbdece047d..88298e7c68 100644 --- a/transport/src/main/java/io/netty/channel/DefaultChannelPromise.java +++ b/transport/src/main/java/io/netty/channel/DefaultChannelPromise.java @@ -378,7 +378,7 @@ public class DefaultChannelPromise extends FlushCheckpoint implements ChannelPro private synchronized boolean failure0(Throwable cause) { // Allow only once. - if (cause != null) { + if (this.cause != null) { return false; }