From edb91afcd6cd4347c046372d05f28f0b5985ba99 Mon Sep 17 00:00:00 2001 From: Scott Mitchell Date: Tue, 15 Sep 2015 15:33:17 -0700 Subject: [PATCH] Http2LifecycleManager.onException rename Motivation: Http2LifecycleManager.onException takes a Throwable as a paramter and not an Exception. There are also onConnectionError and onStreamError methods in the codec. We should rename this method to onError for consistency and clarity. Modifications: - Rename Http2LifecycleManager.onException to Http2LifecycleManager.onError Result: More consistent and clarified interface. --- .../codec/http2/DefaultHttp2ConnectionEncoder.java | 6 +++--- .../netty/handler/codec/http2/Http2ConnectionHandler.java | 8 ++++---- .../netty/handler/codec/http2/Http2LifecycleManager.java | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/codec-http2/src/main/java/io/netty/handler/codec/http2/DefaultHttp2ConnectionEncoder.java b/codec-http2/src/main/java/io/netty/handler/codec/http2/DefaultHttp2ConnectionEncoder.java index d84e4c726e..1112a10146 100644 --- a/codec-http2/src/main/java/io/netty/handler/codec/http2/DefaultHttp2ConnectionEncoder.java +++ b/codec-http2/src/main/java/io/netty/handler/codec/http2/DefaultHttp2ConnectionEncoder.java @@ -171,7 +171,7 @@ public class DefaultHttp2ConnectionEncoder implements Http2ConnectionEncoder { endOfStream, promise)); return promise; } catch (Http2NoMoreStreamIdsException e) { - lifecycleManager.onException(ctx, e); + lifecycleManager.onError(ctx, e); return promise.setFailure(e); } catch (Throwable e) { return promise.setFailure(e); @@ -332,7 +332,7 @@ public class DefaultHttp2ConnectionEncoder implements Http2ConnectionEncoder { @Override public void error(ChannelHandlerContext ctx, Throwable cause) { queue.releaseAndFailAll(cause); - lifecycleManager.onException(ctx, cause); + lifecycleManager.onError(ctx, cause); promise.tryFailure(cause); } @@ -400,7 +400,7 @@ public class DefaultHttp2ConnectionEncoder implements Http2ConnectionEncoder { @Override public void error(ChannelHandlerContext ctx, Throwable cause) { if (ctx != null) { - lifecycleManager.onException(ctx, cause); + lifecycleManager.onError(ctx, cause); } promise.tryFailure(cause); } diff --git a/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2ConnectionHandler.java b/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2ConnectionHandler.java index 2eb280b694..4cd41ba4f8 100644 --- a/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2ConnectionHandler.java +++ b/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2ConnectionHandler.java @@ -274,7 +274,7 @@ public class Http2ConnectionHandler extends ByteToMessageDecoder implements Http byteDecoder.decode(ctx, in, out); } } catch (Throwable e) { - onException(ctx, e); + onError(ctx, e); } } @@ -391,7 +391,7 @@ public class Http2ConnectionHandler extends ByteToMessageDecoder implements Http try { decoder.decodeFrame(ctx, in, out); } catch (Throwable e) { - onException(ctx, e); + onError(ctx, e); } } } @@ -524,7 +524,7 @@ public class Http2ConnectionHandler extends ByteToMessageDecoder implements Http public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { if (getEmbeddedHttp2Exception(cause) != null) { // Some exception in the causality chain is an Http2Exception - handle it. - onException(ctx, cause); + onError(ctx, cause); } else { super.exceptionCaught(ctx, cause); } @@ -590,7 +590,7 @@ public class Http2ConnectionHandler extends ByteToMessageDecoder implements Http * Central handler for all exceptions caught during HTTP/2 processing. */ @Override - public void onException(ChannelHandlerContext ctx, Throwable cause) { + public void onError(ChannelHandlerContext ctx, Throwable cause) { Http2Exception embedded = getEmbeddedHttp2Exception(cause); if (isStreamError(embedded)) { onStreamError(ctx, cause, (StreamException) embedded); diff --git a/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2LifecycleManager.java b/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2LifecycleManager.java index 5efd94a8f0..605a25fe12 100644 --- a/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2LifecycleManager.java +++ b/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2LifecycleManager.java @@ -85,7 +85,7 @@ public interface Http2LifecycleManager { ByteBuf debugData, ChannelPromise promise); /** - * Processes the given exception. + * Processes the given error. */ - void onException(ChannelHandlerContext ctx, Throwable cause); + void onError(ChannelHandlerContext ctx, Throwable cause); }