Cleanup : String.length() == 0 replaced with String.isEmpty, removed unnecessary assert, class cast

Motivation:

IDE warnings fixes.

Modification:

String.length() == 0 replaced with String.isEmpty(), unnecessary assertion removed, unnecessary class cast and correct StringBuilder size, empty else block commented.

Result:

Code easier to read. No warnings.
This commit is contained in:
Dmitriy Dumanskiy 2017-02-13 23:31:09 +02:00 committed by Norman Maurer
parent f3657702e0
commit 49d4c3520d
3 changed files with 4 additions and 4 deletions

View File

@ -576,10 +576,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) {

View File

@ -42,7 +42,7 @@ public class HttpRequestEncoder extends HttpObjectEncoder<HttpRequest> {
// See http://tools.ietf.org/html/rfc2616#section-5.1.2
String uri = request.getUri();
if (uri.length() == 0) {
if (uri.isEmpty()) {
uri += SLASH;
} else {
int start = uri.indexOf("://");

View File

@ -152,7 +152,6 @@ public class DefaultAttributeMap implements AttributeMap {
private void remove0() {
synchronized (head) {
assert head != null;
if (prev == null) {
// Removed before.
return;