diff --git a/transport/src/main/java/io/netty/channel/ChannelHandlerLifeCycleException.java b/transport/src/main/java/io/netty/channel/ChannelHandlerLifeCycleException.java deleted file mode 100644 index 42c1e0fe80..0000000000 --- a/transport/src/main/java/io/netty/channel/ChannelHandlerLifeCycleException.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2012 The Netty Project - * - * The Netty Project licenses this file to you under the Apache License, - * version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at: - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ -package io.netty.channel; - -/** - * A {@link RuntimeException} which is thrown when a - * {@link LifeCycleAwareChannelHandler} throws an {@link Exception} - * in its handler methods. - * - * @apiviz.exclude - */ -public class ChannelHandlerLifeCycleException extends RuntimeException { - - private static final long serialVersionUID = 8764799996088850672L; - - /** - * Creates a new exception. - */ - public ChannelHandlerLifeCycleException() { - } - - /** - * Creates a new exception. - */ - public ChannelHandlerLifeCycleException(String message, Throwable cause) { - super(message, cause); - } - - /** - * Creates a new exception. - */ - public ChannelHandlerLifeCycleException(String message) { - super(message); - } - - /** - * Creates a new exception. - */ - public ChannelHandlerLifeCycleException(Throwable cause) { - super(cause); - } -} diff --git a/transport/src/main/java/io/netty/channel/DefaultChannelPipeline.java b/transport/src/main/java/io/netty/channel/DefaultChannelPipeline.java index b95417592e..5c30fe9d29 100755 --- a/transport/src/main/java/io/netty/channel/DefaultChannelPipeline.java +++ b/transport/src/main/java/io/netty/channel/DefaultChannelPipeline.java @@ -581,8 +581,8 @@ public class DefaultChannelPipeline implements ChannelPipeline { } name2ctx.put(newName, newCtx); - ChannelHandlerLifeCycleException removeException = null; - ChannelHandlerLifeCycleException addException = null; + ChannelPipelineException removeException = null; + ChannelPipelineException addException = null; boolean removed = false; try { callAfterRemove(ctx); @@ -591,7 +591,7 @@ public class DefaultChannelPipeline implements ChannelPipeline { ctx.readable(true); removed = true; - } catch (ChannelHandlerLifeCycleException e) { + } catch (ChannelPipelineException e) { removeException = e; } @@ -599,14 +599,14 @@ public class DefaultChannelPipeline implements ChannelPipeline { try { callAfterAdd(newCtx); added = true; - } catch (ChannelHandlerLifeCycleException e) { + } catch (ChannelPipelineException e) { addException = e; } if (!removed && !added) { logger.warn(removeException.getMessage(), removeException); logger.warn(addException.getMessage(), addException); - throw new ChannelHandlerLifeCycleException( + throw new ChannelPipelineException( "Both " + ctx.handler().getClass().getName() + ".afterRemove() and " + newCtx.handler().getClass().getName() + ".afterAdd() failed; see logs."); @@ -622,7 +622,7 @@ public class DefaultChannelPipeline implements ChannelPipeline { if (handler instanceof ChannelStateHandlerAdapter) { ChannelStateHandlerAdapter h = (ChannelStateHandlerAdapter) handler; if (!h.isSharable() && h.added) { - throw new ChannelHandlerLifeCycleException( + throw new ChannelPipelineException( h.getClass().getName() + " is not a @Sharable handler, so can't be added or removed multiple times."); } @@ -631,7 +631,7 @@ public class DefaultChannelPipeline implements ChannelPipeline { try { handler.beforeAdd(ctx); } catch (Throwable t) { - throw new ChannelHandlerLifeCycleException( + throw new ChannelPipelineException( handler.getClass().getName() + ".beforeAdd() has thrown an exception; not adding.", t); } @@ -652,11 +652,11 @@ public class DefaultChannelPipeline implements ChannelPipeline { } if (removed) { - throw new ChannelHandlerLifeCycleException( + throw new ChannelPipelineException( ctx.handler().getClass().getName() + ".afterAdd() has thrown an exception; removed.", t); } else { - throw new ChannelHandlerLifeCycleException( + throw new ChannelPipelineException( ctx.handler().getClass().getName() + ".afterAdd() has thrown an exception; also failed to remove.", t); } @@ -667,7 +667,7 @@ public class DefaultChannelPipeline implements ChannelPipeline { try { ctx.handler().beforeRemove(ctx); } catch (Throwable t) { - throw new ChannelHandlerLifeCycleException( + throw new ChannelPipelineException( ctx.handler().getClass().getName() + ".beforeRemove() has thrown an exception; not removing.", t); } @@ -677,7 +677,7 @@ public class DefaultChannelPipeline implements ChannelPipeline { try { ctx.handler().afterRemove(ctx); } catch (Throwable t) { - throw new ChannelHandlerLifeCycleException( + throw new ChannelPipelineException( ctx.handler().getClass().getName() + ".afterRemove() has thrown an exception.", t); }