Cleanup : String.length() == 0 replaced with String.isEmpty, removed unnecessary assert, class cast
This commit is contained in:
parent
90bc605477
commit
506f0d8f8c
@ -574,10 +574,11 @@ public abstract class HttpObjectDecoder extends ByteToMessageDecoder {
|
||||
do {
|
||||
char firstChar = line.charAt(0);
|
||||
if (name != null && (firstChar == ' ' || firstChar == '\t')) {
|
||||
StringBuilder buf = new StringBuilder(value.length() + line.length() + 1);
|
||||
String trimmedLine = line.toString().trim();
|
||||
StringBuilder buf = new StringBuilder(value.length() + trimmedLine.length() + 1);
|
||||
buf.append(value)
|
||||
.append(' ')
|
||||
.append(line.toString().trim());
|
||||
.append(trimmedLine);
|
||||
value = buf.toString();
|
||||
} else {
|
||||
if (name != null) {
|
||||
|
@ -45,7 +45,7 @@ public class HttpRequestEncoder extends HttpObjectEncoder<HttpRequest> {
|
||||
// See http://tools.ietf.org/html/rfc2616#section-5.1.2
|
||||
String uri = request.uri();
|
||||
|
||||
if (uri.length() == 0) {
|
||||
if (uri.isEmpty()) {
|
||||
uri += SLASH;
|
||||
} else {
|
||||
int start = uri.indexOf("://");
|
||||
|
@ -49,7 +49,7 @@ class PerMessageDeflateDecoder extends DeflateDecoder {
|
||||
|
||||
@Override
|
||||
protected int newRsv(WebSocketFrame msg) {
|
||||
return (((WebSocketFrame) msg).rsv() & WebSocketExtension.RSV1) > 0 ?
|
||||
return (msg.rsv() & WebSocketExtension.RSV1) > 0 ?
|
||||
msg.rsv() ^ WebSocketExtension.RSV1 : msg.rsv();
|
||||
}
|
||||
|
||||
|
@ -184,7 +184,6 @@ public class DefaultAttributeMap implements AttributeMap {
|
||||
|
||||
private void remove0() {
|
||||
synchronized (head) {
|
||||
assert head != null;
|
||||
if (prev == null) {
|
||||
// Removed before.
|
||||
return;
|
||||
|
@ -44,7 +44,7 @@ public final class Socks4ProxyHandler extends ProxyHandler {
|
||||
|
||||
public Socks4ProxyHandler(SocketAddress proxyAddress, String username) {
|
||||
super(proxyAddress);
|
||||
if (username != null && username.length() == 0) {
|
||||
if (username != null && username.isEmpty()) {
|
||||
username = null;
|
||||
}
|
||||
this.username = username;
|
||||
|
@ -65,10 +65,10 @@ public final class Socks5ProxyHandler extends ProxyHandler {
|
||||
|
||||
public Socks5ProxyHandler(SocketAddress proxyAddress, String username, String password) {
|
||||
super(proxyAddress);
|
||||
if (username != null && username.length() == 0) {
|
||||
if (username != null && username.isEmpty()) {
|
||||
username = null;
|
||||
}
|
||||
if (password != null && password.length() == 0) {
|
||||
if (password != null && password.isEmpty()) {
|
||||
password = null;
|
||||
}
|
||||
this.username = username;
|
||||
|
Loading…
Reference in New Issue
Block a user