Fixed issue: NETTY-13 (Stack overflow when an exception is thrown while processing ExceptionEvent)

* Renamed notifyException to notifyHandlerException
* Prevented infinite recursion caused by failure on exceptionCaught
This commit is contained in:
Trustin Lee 2008-08-18 11:11:55 +00:00
parent a05905f64a
commit a7c73d2e52

View File

@ -358,7 +358,7 @@ public class DefaultChannelPipeline implements ChannelPipeline {
try {
((ChannelUpstreamHandler) ctx.getHandler()).handleUpstream(ctx, e);
} catch (Throwable t) {
notifyException(e, t);
notifyHandlerException(e, t);
}
}
@ -369,7 +369,7 @@ public class DefaultChannelPipeline implements ChannelPipeline {
getSink().eventSunk(this, e);
return;
} catch (Throwable t) {
notifyException(e, t);
notifyHandlerException(e, t);
}
}
@ -380,7 +380,7 @@ public class DefaultChannelPipeline implements ChannelPipeline {
try {
((ChannelDownstreamHandler) ctx.getHandler()).handleDownstream(ctx, e);
} catch (Throwable t) {
notifyException(e, t);
notifyHandlerException(e, t);
}
}
@ -416,7 +416,14 @@ public class DefaultChannelPipeline implements ChannelPipeline {
return realCtx;
}
void notifyException(ChannelEvent e, Throwable t) {
void notifyHandlerException(ChannelEvent e, Throwable t) {
if (e instanceof ExceptionEvent) {
logger.warn(
"An exception was thrown by a user handler " +
"while handling an exception event (" + e + ")", t);
return;
}
ChannelPipelineException pe;
if (t instanceof ChannelPipelineException) {
pe = (ChannelPipelineException) t;
@ -561,7 +568,7 @@ public class DefaultChannelPipeline implements ChannelPipeline {
try {
getSink().eventSunk(DefaultChannelPipeline.this, e);
} catch (Throwable t) {
notifyException(e, t);
notifyHandlerException(e, t);
}
} else {
DefaultChannelPipeline.this.sendDownstream(prev, e);