Use StringUtil.simpleClassName(..) instead of Class.getSimpleName() where necessary
- Class.getSimpleName() doesn't render anonymous classes very well - + some minor cleanup
This commit is contained in:
parent
0d1567da0b
commit
54db9ec725
@ -18,6 +18,7 @@ package io.netty.buffer;
|
||||
import io.netty.util.IllegalReferenceCountException;
|
||||
import io.netty.util.ResourceLeakDetector;
|
||||
import io.netty.util.internal.PlatformDependent;
|
||||
import io.netty.util.internal.StringUtil;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@ -1086,11 +1087,11 @@ public abstract class AbstractByteBuf extends ByteBuf {
|
||||
@Override
|
||||
public String toString() {
|
||||
if (refCnt() == 0) {
|
||||
return getClass().getSimpleName() + "(freed)";
|
||||
return StringUtil.simpleClassName(this) + "(freed)";
|
||||
}
|
||||
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append(getClass().getSimpleName());
|
||||
buf.append(StringUtil.simpleClassName(this));
|
||||
buf.append("(ridx: ");
|
||||
buf.append(readerIndex);
|
||||
buf.append(", widx: ");
|
||||
|
@ -16,6 +16,7 @@
|
||||
package io.netty.buffer;
|
||||
|
||||
import io.netty.util.IllegalReferenceCountException;
|
||||
import io.netty.util.internal.StringUtil;
|
||||
|
||||
/**
|
||||
* Default implementation of a {@link ByteBufHolder} that holds it's data in a {@link ByteBuf}.
|
||||
@ -79,6 +80,6 @@ public class DefaultByteBufHolder implements ByteBufHolder {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getClass().getSimpleName() + '(' + content().toString() + ')';
|
||||
return StringUtil.simpleClassName(this) + '(' + content().toString() + ')';
|
||||
}
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ package io.netty.buffer;
|
||||
|
||||
import io.netty.util.internal.EmptyArrays;
|
||||
import io.netty.util.internal.PlatformDependent;
|
||||
import io.netty.util.internal.StringUtil;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
@ -64,7 +65,7 @@ public final class EmptyByteBuf extends ByteBuf {
|
||||
|
||||
this.alloc = alloc;
|
||||
this.order = order;
|
||||
str = getClass().getSimpleName() + (order == ByteOrder.BIG_ENDIAN? "BE" : "LE");
|
||||
str = StringUtil.simpleClassName(this) + (order == ByteOrder.BIG_ENDIAN? "BE" : "LE");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -16,6 +16,7 @@
|
||||
package io.netty.buffer;
|
||||
|
||||
import io.netty.util.ResourceLeak;
|
||||
import io.netty.util.internal.StringUtil;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@ -40,7 +41,7 @@ class ReadOnlyByteBufferBuf extends AbstractReferenceCountedByteBuf {
|
||||
public ReadOnlyByteBufferBuf(ByteBufAllocator allocator, ByteBuffer buffer) {
|
||||
super(buffer.remaining());
|
||||
if (!buffer.isReadOnly()) {
|
||||
throw new IllegalArgumentException("must be a readonly buffer: " + buffer.getClass().getSimpleName());
|
||||
throw new IllegalArgumentException("must be a readonly buffer: " + StringUtil.simpleClassName(buffer));
|
||||
}
|
||||
|
||||
this.allocator = allocator;
|
||||
|
@ -16,6 +16,7 @@
|
||||
package io.netty.handler.codec.http;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.util.internal.StringUtil;
|
||||
|
||||
/**
|
||||
* The default {@link HttpContent} implementation.
|
||||
@ -78,6 +79,6 @@ public class DefaultHttpContent extends DefaultHttpObject implements HttpContent
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getClass().getSimpleName() + "(data: " + content() + ", getDecoderResult: " + getDecoderResult() + ')';
|
||||
return StringUtil.simpleClassName(this) + "(data: " + content() + ", getDecoderResult: " + getDecoderResult() + ')';
|
||||
}
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ public abstract class DefaultHttpMessage extends DefaultHttpObject implements Ht
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append(getClass().getSimpleName());
|
||||
buf.append(StringUtil.simpleClassName(this));
|
||||
buf.append("(version: ");
|
||||
buf.append(getProtocolVersion().text());
|
||||
buf.append(", keepAlive: ");
|
||||
|
@ -81,7 +81,7 @@ public class DefaultHttpRequest extends DefaultHttpMessage implements HttpReques
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append(getClass().getSimpleName());
|
||||
buf.append(StringUtil.simpleClassName(this));
|
||||
buf.append(", decodeResult: ");
|
||||
buf.append(getDecoderResult());
|
||||
buf.append(')');
|
||||
|
@ -61,7 +61,7 @@ public class DefaultHttpResponse extends DefaultHttpMessage implements HttpRespo
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append(getClass().getSimpleName());
|
||||
buf.append(StringUtil.simpleClassName(this));
|
||||
buf.append("(decodeResult: ");
|
||||
buf.append(getDecoderResult());
|
||||
buf.append(')');
|
||||
|
@ -20,6 +20,7 @@ import io.netty.channel.ChannelHandlerContext;
|
||||
import io.netty.channel.FileRegion;
|
||||
import io.netty.handler.codec.MessageToMessageEncoder;
|
||||
import io.netty.util.CharsetUtil;
|
||||
import io.netty.util.internal.StringUtil;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -60,7 +61,7 @@ public abstract class HttpObjectEncoder<H extends HttpMessage> extends MessageTo
|
||||
protected void encode(ChannelHandlerContext ctx, Object msg, List<Object> out) throws Exception {
|
||||
if (msg instanceof HttpMessage) {
|
||||
if (state != ST_INIT) {
|
||||
throw new IllegalStateException("unexpected message type: " + msg.getClass().getSimpleName());
|
||||
throw new IllegalStateException("unexpected message type: " + StringUtil.simpleClassName(msg));
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "CastConflictsWithInstanceof" })
|
||||
@ -76,7 +77,7 @@ public abstract class HttpObjectEncoder<H extends HttpMessage> extends MessageTo
|
||||
}
|
||||
if (msg instanceof HttpContent || msg instanceof ByteBuf || msg instanceof FileRegion) {
|
||||
if (state == ST_INIT) {
|
||||
throw new IllegalStateException("unexpected message type: " + msg.getClass().getSimpleName());
|
||||
throw new IllegalStateException("unexpected message type: " + StringUtil.simpleClassName(msg));
|
||||
}
|
||||
|
||||
int contentLength = contentLength(msg);
|
||||
@ -148,7 +149,7 @@ public abstract class HttpObjectEncoder<H extends HttpMessage> extends MessageTo
|
||||
if (msg instanceof FileRegion) {
|
||||
return ((FileRegion) msg).retain();
|
||||
}
|
||||
throw new IllegalStateException("unexpected message type: " + msg.getClass().getSimpleName());
|
||||
throw new IllegalStateException("unexpected message type: " + StringUtil.simpleClassName(msg));
|
||||
}
|
||||
|
||||
private static int contentLength(Object msg) {
|
||||
@ -161,7 +162,7 @@ public abstract class HttpObjectEncoder<H extends HttpMessage> extends MessageTo
|
||||
if (msg instanceof FileRegion) {
|
||||
return (int) ((FileRegion) msg).count();
|
||||
}
|
||||
throw new IllegalStateException("unexpected message type: " + msg.getClass().getSimpleName());
|
||||
throw new IllegalStateException("unexpected message type: " + StringUtil.simpleClassName(msg));
|
||||
}
|
||||
|
||||
private static void encodeHeaders(ByteBuf buf, HttpHeaders headers) {
|
||||
|
@ -17,6 +17,7 @@ package io.netty.handler.codec.http.websocketx;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.DefaultByteBufHolder;
|
||||
import io.netty.util.internal.StringUtil;
|
||||
|
||||
/**
|
||||
* Base class for web socket frames
|
||||
@ -67,7 +68,7 @@ public abstract class WebSocketFrame extends DefaultByteBufHolder {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getClass().getSimpleName() + "(data: " + content().toString() + ')';
|
||||
return StringUtil.simpleClassName(this) + "(data: " + content().toString() + ')';
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -122,7 +122,7 @@ public class DefaultSpdyDataFrame extends DefaultSpdyStreamFrame implements Spdy
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append(getClass().getSimpleName());
|
||||
buf.append(StringUtil.simpleClassName(this));
|
||||
buf.append("(last: ");
|
||||
buf.append(isLast());
|
||||
buf.append(')');
|
||||
|
@ -84,7 +84,7 @@ public class DefaultSpdyGoAwayFrame implements SpdyGoAwayFrame {
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append(getClass().getSimpleName());
|
||||
buf.append(StringUtil.simpleClassName(this));
|
||||
buf.append(StringUtil.NEWLINE);
|
||||
buf.append("--> Last-good-stream-ID = ");
|
||||
buf.append(getLastGoodStreamId());
|
||||
|
@ -80,7 +80,7 @@ public class DefaultSpdyHeadersFrame extends DefaultSpdyStreamFrame
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append(getClass().getSimpleName());
|
||||
buf.append(StringUtil.simpleClassName(this));
|
||||
buf.append("(last: ");
|
||||
buf.append(isLast());
|
||||
buf.append(')');
|
||||
|
@ -47,7 +47,7 @@ public class DefaultSpdyPingFrame implements SpdyPingFrame {
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append(getClass().getSimpleName());
|
||||
buf.append(StringUtil.simpleClassName(this));
|
||||
buf.append(StringUtil.NEWLINE);
|
||||
buf.append("--> ID = ");
|
||||
buf.append(getId());
|
||||
|
@ -72,7 +72,7 @@ public class DefaultSpdyRstStreamFrame extends DefaultSpdyStreamFrame
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append(getClass().getSimpleName());
|
||||
buf.append(StringUtil.simpleClassName(this));
|
||||
buf.append(StringUtil.NEWLINE);
|
||||
buf.append("--> Stream-ID = ");
|
||||
buf.append(getStreamId());
|
||||
|
@ -153,7 +153,7 @@ public class DefaultSpdySettingsFrame implements SpdySettingsFrame {
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append(getClass().getSimpleName());
|
||||
buf.append(StringUtil.simpleClassName(this));
|
||||
buf.append(StringUtil.NEWLINE);
|
||||
appendSettings(buf);
|
||||
buf.setLength(buf.length() - StringUtil.NEWLINE.length());
|
||||
|
@ -53,7 +53,7 @@ public class DefaultSpdySynReplyFrame extends DefaultSpdyHeadersFrame
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append(getClass().getSimpleName());
|
||||
buf.append(StringUtil.simpleClassName(this));
|
||||
buf.append("(last: ");
|
||||
buf.append(isLast());
|
||||
buf.append(')');
|
||||
|
@ -104,7 +104,7 @@ public class DefaultSpdySynStreamFrame extends DefaultSpdyHeadersFrame
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append(getClass().getSimpleName());
|
||||
buf.append(StringUtil.simpleClassName(this));
|
||||
buf.append("(last: ");
|
||||
buf.append(isLast());
|
||||
buf.append("; unidirectional: ");
|
||||
|
@ -70,7 +70,7 @@ public class DefaultSpdyWindowUpdateFrame implements SpdyWindowUpdateFrame {
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append(getClass().getSimpleName());
|
||||
buf.append(StringUtil.simpleClassName(this));
|
||||
buf.append(StringUtil.NEWLINE);
|
||||
buf.append("--> Stream-ID = ");
|
||||
buf.append(getStreamId());
|
||||
|
@ -21,6 +21,7 @@ import io.netty.buffer.ByteBufProcessor;
|
||||
import io.netty.buffer.SwappedByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import io.netty.util.Signal;
|
||||
import io.netty.util.internal.StringUtil;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
@ -788,7 +789,7 @@ final class ReplayingDecoderBuffer extends ByteBuf {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getClass().getSimpleName() + '(' +
|
||||
return StringUtil.simpleClassName(this) + '(' +
|
||||
"ridx=" +
|
||||
readerIndex() +
|
||||
", " +
|
||||
|
@ -16,6 +16,7 @@
|
||||
package io.netty.util;
|
||||
|
||||
import io.netty.util.internal.PlatformDependent;
|
||||
import io.netty.util.internal.StringUtil;
|
||||
import io.netty.util.internal.logging.InternalLogger;
|
||||
import io.netty.util.internal.logging.InternalLoggerFactory;
|
||||
|
||||
@ -541,7 +542,7 @@ public class HashedWheelTimer implements Timer {
|
||||
long remaining = deadline - currentTime + startTime;
|
||||
|
||||
StringBuilder buf = new StringBuilder(192);
|
||||
buf.append(getClass().getSimpleName());
|
||||
buf.append(StringUtil.simpleClassName(this));
|
||||
buf.append('(');
|
||||
|
||||
buf.append("deadline: ");
|
||||
|
@ -17,6 +17,7 @@
|
||||
package io.netty.util;
|
||||
|
||||
import io.netty.util.internal.PlatformDependent;
|
||||
import io.netty.util.internal.StringUtil;
|
||||
import io.netty.util.internal.SystemPropertyUtil;
|
||||
import io.netty.util.internal.logging.InternalLogger;
|
||||
import io.netty.util.internal.logging.InternalLoggerFactory;
|
||||
@ -70,7 +71,7 @@ public final class ResourceLeakDetector<T> {
|
||||
private long leakCheckCnt;
|
||||
|
||||
public ResourceLeakDetector(Class<?> resourceType) {
|
||||
this(resourceType.getSimpleName());
|
||||
this(StringUtil.simpleClassName(resourceType));
|
||||
}
|
||||
|
||||
public ResourceLeakDetector(String resourceType) {
|
||||
@ -78,7 +79,7 @@ public final class ResourceLeakDetector<T> {
|
||||
}
|
||||
|
||||
public ResourceLeakDetector(Class<?> resourceType, int samplingInterval, long maxActive) {
|
||||
this(resourceType.getSimpleName(), samplingInterval, maxActive);
|
||||
this(StringUtil.simpleClassName(resourceType), samplingInterval, maxActive);
|
||||
}
|
||||
|
||||
public ResourceLeakDetector(String resourceType, int samplingInterval, long maxActive) {
|
||||
|
@ -15,6 +15,8 @@
|
||||
*/
|
||||
package io.netty.util.internal.logging;
|
||||
|
||||
import io.netty.util.internal.StringUtil;
|
||||
|
||||
import java.io.ObjectStreamException;
|
||||
import java.io.Serializable;
|
||||
|
||||
@ -183,6 +185,6 @@ public abstract class AbstractInternalLogger implements InternalLogger, Serializ
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getClass().getSimpleName() + '(' + name() + ')';
|
||||
return StringUtil.simpleClassName(this) + '(' + name() + ')';
|
||||
}
|
||||
}
|
||||
|
@ -35,6 +35,7 @@ import io.netty.handler.codec.http.websocketx.WebSocketFrame;
|
||||
import io.netty.handler.codec.http.websocketx.WebSocketServerHandshaker;
|
||||
import io.netty.handler.codec.http.websocketx.WebSocketServerHandshakerFactory;
|
||||
import io.netty.util.CharsetUtil;
|
||||
import io.netty.util.internal.StringUtil;
|
||||
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
@ -97,7 +98,7 @@ public class AutobahnServerHandler extends ChannelInboundHandlerAdapter {
|
||||
private void handleWebSocketFrame(ChannelHandlerContext ctx, WebSocketFrame frame) {
|
||||
if (logger.isLoggable(Level.FINE)) {
|
||||
logger.fine(String.format(
|
||||
"Channel %s received %s", ctx.channel().hashCode(), frame.getClass().getSimpleName()));
|
||||
"Channel %s received %s", ctx.channel().hashCode(), StringUtil.simpleClassName(frame)));
|
||||
}
|
||||
|
||||
if (frame instanceof CloseWebSocketFrame) {
|
||||
|
@ -22,6 +22,7 @@ import io.netty.channel.ChannelOption;
|
||||
import io.netty.testsuite.transport.sctp.SctpTestPermutation.Factory;
|
||||
import io.netty.testsuite.util.TestUtils;
|
||||
import io.netty.util.NetUtil;
|
||||
import io.netty.util.internal.StringUtil;
|
||||
import io.netty.util.internal.logging.InternalLogger;
|
||||
import io.netty.util.internal.logging.InternalLoggerFactory;
|
||||
import org.junit.Rule;
|
||||
@ -37,7 +38,7 @@ public abstract class AbstractSctpTest {
|
||||
|
||||
private static final List<Entry<Factory<ServerBootstrap>, Factory<Bootstrap>>> COMBO =
|
||||
SctpTestPermutation.sctpChannel();
|
||||
private static List<ByteBufAllocator> ALLOCATORS = SctpTestPermutation.allocator();
|
||||
private static final List<ByteBufAllocator> ALLOCATORS = SctpTestPermutation.allocator();
|
||||
|
||||
@Rule
|
||||
public final TestName testName = new TestName();
|
||||
@ -65,7 +66,7 @@ public abstract class AbstractSctpTest {
|
||||
cb.option(ChannelOption.ALLOCATOR, allocator);
|
||||
logger.info(String.format(
|
||||
"Running: %s %d of %d (%s + %s) with %s",
|
||||
testName.getMethodName(), ++ i, COMBO.size(), sb, cb, allocator.getClass().getSimpleName()));
|
||||
testName.getMethodName(), ++ i, COMBO.size(), sb, cb, StringUtil.simpleClassName(allocator)));
|
||||
try {
|
||||
Method m = getClass().getDeclaredMethod(
|
||||
testName.getMethodName(), ServerBootstrap.class, Bootstrap.class);
|
||||
|
@ -21,6 +21,7 @@ import io.netty.channel.ChannelOption;
|
||||
import io.netty.testsuite.transport.socket.SocketTestPermutation.Factory;
|
||||
import io.netty.testsuite.util.TestUtils;
|
||||
import io.netty.util.NetUtil;
|
||||
import io.netty.util.internal.StringUtil;
|
||||
import io.netty.util.internal.logging.InternalLogger;
|
||||
import io.netty.util.internal.logging.InternalLoggerFactory;
|
||||
import org.junit.Rule;
|
||||
@ -54,7 +55,7 @@ public abstract class AbstractClientSocketTest {
|
||||
cb.option(ChannelOption.ALLOCATOR, allocator);
|
||||
logger.info(String.format(
|
||||
"Running: %s %d of %d with %s",
|
||||
testName.getMethodName(), ++ i, COMBO.size(), allocator.getClass().getSimpleName()));
|
||||
testName.getMethodName(), ++ i, COMBO.size(), StringUtil.simpleClassName(allocator)));
|
||||
try {
|
||||
Method m = getClass().getDeclaredMethod(
|
||||
testName.getMethodName(), Bootstrap.class);
|
||||
|
@ -21,6 +21,7 @@ import io.netty.channel.ChannelOption;
|
||||
import io.netty.testsuite.transport.socket.SocketTestPermutation.Factory;
|
||||
import io.netty.testsuite.util.TestUtils;
|
||||
import io.netty.util.NetUtil;
|
||||
import io.netty.util.internal.StringUtil;
|
||||
import io.netty.util.internal.logging.InternalLogger;
|
||||
import io.netty.util.internal.logging.InternalLoggerFactory;
|
||||
import org.junit.Rule;
|
||||
@ -60,7 +61,7 @@ public abstract class AbstractDatagramTest {
|
||||
cb.option(ChannelOption.ALLOCATOR, allocator);
|
||||
logger.info(String.format(
|
||||
"Running: %s %d of %d (%s + %s) with %s",
|
||||
testName.getMethodName(), ++ i, COMBO.size(), sb, cb, allocator.getClass().getSimpleName()));
|
||||
testName.getMethodName(), ++ i, COMBO.size(), sb, cb, StringUtil.simpleClassName(allocator)));
|
||||
try {
|
||||
Method m = getClass().getDeclaredMethod(
|
||||
testName.getMethodName(), Bootstrap.class, Bootstrap.class);
|
||||
|
@ -21,6 +21,7 @@ import io.netty.channel.ChannelOption;
|
||||
import io.netty.testsuite.transport.socket.SocketTestPermutation.Factory;
|
||||
import io.netty.testsuite.util.TestUtils;
|
||||
import io.netty.util.NetUtil;
|
||||
import io.netty.util.internal.StringUtil;
|
||||
import io.netty.util.internal.logging.InternalLogger;
|
||||
import io.netty.util.internal.logging.InternalLoggerFactory;
|
||||
import org.junit.Rule;
|
||||
@ -57,7 +58,7 @@ public abstract class AbstractServerSocketTest {
|
||||
|
||||
logger.info(String.format(
|
||||
"Running: %s %d of %d (%s) with %s",
|
||||
testName.getMethodName(), ++ i, COMBO.size(), sb, allocator.getClass().getSimpleName()));
|
||||
testName.getMethodName(), ++ i, COMBO.size(), sb, StringUtil.simpleClassName(allocator)));
|
||||
try {
|
||||
Method m = getClass().getDeclaredMethod(
|
||||
testName.getMethodName(), ServerBootstrap.class);
|
||||
|
@ -22,6 +22,7 @@ import io.netty.channel.ChannelOption;
|
||||
import io.netty.testsuite.transport.socket.SocketTestPermutation.Factory;
|
||||
import io.netty.testsuite.util.TestUtils;
|
||||
import io.netty.util.NetUtil;
|
||||
import io.netty.util.internal.StringUtil;
|
||||
import io.netty.util.internal.logging.InternalLogger;
|
||||
import io.netty.util.internal.logging.InternalLoggerFactory;
|
||||
import org.junit.Rule;
|
||||
@ -67,7 +68,7 @@ public abstract class AbstractSocketTest {
|
||||
|
||||
logger.info(String.format(
|
||||
"Running: %s %d of %d (%s + %s) with %s",
|
||||
testName.getMethodName(), ++ i, COMBO.size(), sb, cb, allocator.getClass().getSimpleName()));
|
||||
testName.getMethodName(), ++ i, COMBO.size(), sb, cb, StringUtil.simpleClassName(allocator)));
|
||||
try {
|
||||
Method m = getClass().getDeclaredMethod(
|
||||
testName.getMethodName(), ServerBootstrap.class, Bootstrap.class);
|
||||
|
@ -26,6 +26,7 @@ import io.netty.channel.ChannelPromise;
|
||||
import io.netty.channel.EventLoop;
|
||||
import io.netty.channel.EventLoopGroup;
|
||||
import io.netty.util.AttributeKey;
|
||||
import io.netty.util.internal.StringUtil;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.net.InetSocketAddress;
|
||||
@ -377,11 +378,11 @@ public abstract class AbstractBootstrap<B extends AbstractBootstrap<B, C>, C ext
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append(getClass().getSimpleName());
|
||||
buf.append(StringUtil.simpleClassName(this));
|
||||
buf.append('(');
|
||||
if (group != null) {
|
||||
buf.append("group: ");
|
||||
buf.append(group.getClass().getSimpleName());
|
||||
buf.append(StringUtil.simpleClassName(group));
|
||||
buf.append(", ");
|
||||
}
|
||||
if (channelFactory != null) {
|
||||
@ -440,7 +441,7 @@ public abstract class AbstractBootstrap<B extends AbstractBootstrap<B, C>, C ext
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return clazz.getSimpleName() + ".class";
|
||||
return StringUtil.simpleClassName(clazz) + ".class";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ import io.netty.channel.EventLoopGroup;
|
||||
import io.netty.channel.ServerChannel;
|
||||
import io.netty.channel.socket.SocketChannel;
|
||||
import io.netty.util.AttributeKey;
|
||||
import io.netty.util.internal.StringUtil;
|
||||
import io.netty.util.internal.logging.InternalLogger;
|
||||
import io.netty.util.internal.logging.InternalLoggerFactory;
|
||||
|
||||
@ -286,7 +287,7 @@ public final class ServerBootstrap extends AbstractBootstrap<ServerBootstrap, Se
|
||||
buf.append(", ");
|
||||
if (childGroup != null) {
|
||||
buf.append("childGroup: ");
|
||||
buf.append(childGroup.getClass().getSimpleName());
|
||||
buf.append(StringUtil.simpleClassName(childGroup));
|
||||
buf.append(", ");
|
||||
}
|
||||
synchronized (childOptions) {
|
||||
|
@ -700,7 +700,7 @@ final class DefaultChannelPipeline implements ChannelPipeline {
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append(getClass().getSimpleName());
|
||||
buf.append(StringUtil.simpleClassName(this));
|
||||
buf.append('{');
|
||||
DefaultChannelHandlerContext ctx = head.next;
|
||||
for (;;) {
|
||||
|
@ -24,6 +24,7 @@ import io.netty.channel.ServerChannel;
|
||||
import io.netty.util.ReferenceCountUtil;
|
||||
import io.netty.util.concurrent.EventExecutor;
|
||||
import io.netty.util.internal.ConcurrentSet;
|
||||
import io.netty.util.internal.StringUtil;
|
||||
|
||||
import java.util.AbstractSet;
|
||||
import java.util.ArrayList;
|
||||
@ -342,7 +343,6 @@ public class DefaultChannelGroup extends AbstractSet<Channel> implements Channel
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getClass().getSimpleName() +
|
||||
"(name: " + name() + ", size: " + size() + ')';
|
||||
return StringUtil.simpleClassName(this) + "(name: " + name() + ", size: " + size() + ')';
|
||||
}
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ package io.netty.channel.local;
|
||||
import io.netty.channel.Channel;
|
||||
import io.netty.channel.ChannelException;
|
||||
import io.netty.util.internal.PlatformDependent;
|
||||
import io.netty.util.internal.StringUtil;
|
||||
|
||||
import java.net.SocketAddress;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
@ -32,8 +33,7 @@ final class LocalChannelRegistry {
|
||||
throw new ChannelException("already bound");
|
||||
}
|
||||
if (!(localAddress instanceof LocalAddress)) {
|
||||
throw new ChannelException(
|
||||
"unsupported address type: " + localAddress.getClass().getSimpleName());
|
||||
throw new ChannelException("unsupported address type: " + StringUtil.simpleClassName(localAddress));
|
||||
}
|
||||
|
||||
LocalAddress addr = (LocalAddress) localAddress;
|
||||
|
Loading…
Reference in New Issue
Block a user