* MessageEvent.getRemoteAddress() does not return null anymore
* Improved the String representation of MessageEvent implementations
This commit is contained in:
parent
17bbe5d3ee
commit
7be842be05
@ -87,7 +87,7 @@ public class DownstreamMessageEvent implements MessageEvent {
|
|||||||
StringUtil.stripControlCharacters(getMessage());
|
StringUtil.stripControlCharacters(getMessage());
|
||||||
} else {
|
} else {
|
||||||
return getChannel().toString() + " WRITE: " +
|
return getChannel().toString() + " WRITE: " +
|
||||||
StringUtil.stripControlCharacters(getMessage()) + ", " +
|
StringUtil.stripControlCharacters(getMessage()) + " to " +
|
||||||
getRemoteAddress();
|
getRemoteAddress();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,12 @@ public class UpstreamMessageEvent implements MessageEvent {
|
|||||||
}
|
}
|
||||||
this.channel = channel;
|
this.channel = channel;
|
||||||
this.message = message;
|
this.message = message;
|
||||||
this.remoteAddress = remoteAddress;
|
|
||||||
|
if (remoteAddress != null) {
|
||||||
|
this.remoteAddress = remoteAddress;
|
||||||
|
} else {
|
||||||
|
this.remoteAddress = channel.getRemoteAddress();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Channel getChannel() {
|
public Channel getChannel() {
|
||||||
@ -78,12 +83,13 @@ public class UpstreamMessageEvent implements MessageEvent {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
if (getRemoteAddress() == null) {
|
// It's safe to use identity comparison in this case.
|
||||||
|
if (getRemoteAddress() == getChannel().getRemoteAddress()) {
|
||||||
return getChannel().toString() + " RECEIVED: " +
|
return getChannel().toString() + " RECEIVED: " +
|
||||||
StringUtil.stripControlCharacters(getMessage());
|
StringUtil.stripControlCharacters(getMessage());
|
||||||
} else {
|
} else {
|
||||||
return getChannel().toString() + " RECEIVED: " +
|
return getChannel().toString() + " RECEIVED: " +
|
||||||
StringUtil.stripControlCharacters(getMessage()) + ", " +
|
StringUtil.stripControlCharacters(getMessage()) + " from " +
|
||||||
getRemoteAddress();
|
getRemoteAddress();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user