-
Notifications
You must be signed in to change notification settings - Fork 26.5k
Closed
Labels
type/bugBugs to being fixedBugs to being fixed
Description
- I have searched the issues of this repository and believe that this is not a duplicate.
Environment
- Dubbo version: 3.2
- Operating System version: macOS Big Sur
- Java version: 8
Steps to reproduce this issue
- simple test
public class NPETest {
protected WorldHandler handler = new WorldHandler();
@Test
void handlerIsNull() throws RemotingException {
Exchangers.bind("",null, handler);
}
}- handler is not null in this step
public ChannelHandlerDispatcher(ChannelHandler... handlers) {
this(handlers == null ? null : Arrays.asList(handlers));
}- channelHandlers will add a null handler
public ChannelHandlerDispatcher(Collection<ChannelHandler> handlers) {
if (CollectionUtils.isNotEmpty(handlers)) {
this.channelHandlers.addAll(handlers);
}
}- connected, disconnected, sent and caught method will NPE
Expected Behavior
channelHandlers have no null object
Actual Behavior
channelHandlers have null object
reason
public ChannelHandlerDispatcher(ChannelHandler... handlers) {
this(handlers == null ? null : Arrays.asList(handlers));
}
public ChannelHandlerDispatcher(Collection<ChannelHandler> handlers) {
if (CollectionUtils.isNotEmpty(handlers)) {
this.channelHandlers.addAll(handlers);
}
}if handlers is null, it will cast to ChannelHandler and use the first method then handlers is not null
we can filter the null object when add to channelHandlers
Can I fix it?
Metadata
Metadata
Assignees
Labels
type/bugBugs to being fixedBugs to being fixed