Null check

This commit is contained in:
Trustin Lee 2009-12-17 10:57:57 +00:00
parent 15aded0df7
commit 9951e19573

View File

@ -40,7 +40,7 @@ import org.jboss.netty.logging.InternalLoggerFactory;
public class DefaultChannelPipeline implements ChannelPipeline { public class DefaultChannelPipeline implements ChannelPipeline {
static final InternalLogger logger = InternalLoggerFactory.getInstance(DefaultChannelPipeline.class); static final InternalLogger logger = InternalLoggerFactory.getInstance(DefaultChannelPipeline.class);
private static final ChannelSink discardingSink = new DiscardingChannelSink(); static final ChannelSink discardingSink = new DiscardingChannelSink();
private volatile Channel channel; private volatile Channel channel;
private volatile ChannelSink sink; private volatile ChannelSink sink;
@ -469,6 +469,10 @@ public class DefaultChannelPipeline implements ChannelPipeline {
public synchronized ChannelHandlerContext getContext( public synchronized ChannelHandlerContext getContext(
Class<? extends ChannelHandler> handlerType) { Class<? extends ChannelHandler> handlerType) {
if (handlerType == null) {
throw new NullPointerException("handlerType");
}
if (name2ctx.isEmpty()) { if (name2ctx.isEmpty()) {
return null; return null;
} }