Fix NPE in NettyConnectionClient.toString (#13934)
This commit is contained in:
parent
c92e7ca72b
commit
392260a30e
|
|
@ -31,6 +31,7 @@ import org.apache.dubbo.remoting.transport.netty4.ssl.SslClientTlsHandler;
|
|||
import org.apache.dubbo.remoting.transport.netty4.ssl.SslContexts;
|
||||
import org.apache.dubbo.remoting.utils.UrlUtils;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
|
@ -337,7 +338,9 @@ public class NettyConnectionClient extends AbstractConnectionClient {
|
|||
@Override
|
||||
public String toString() {
|
||||
return super.toString() + " (Ref=" + this.getCounter() + ",local="
|
||||
+ (getChannel() == null ? null : getChannel().getLocalAddress()) + ",remote=" + getRemoteAddress();
|
||||
+ Optional.ofNullable(getChannel())
|
||||
.map(Channel::getLocalAddress)
|
||||
.orElse(null) + ",remote=" + getRemoteAddress();
|
||||
}
|
||||
|
||||
class ConnectionListener implements ChannelFutureListener {
|
||||
|
|
|
|||
Loading…
Reference in New Issue