From 0b0c804c2c85b0bd44ad6028b136334f749d9c1b Mon Sep 17 00:00:00 2001 From: Yousha Aleayoub Date: Tue, 6 Sep 2016 05:48:16 +0430 Subject: [PATCH] Remove unnecessary conditional statements. --- .../com/github/kevinsawicki/http/HttpRequest.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/src/main/java/com/github/kevinsawicki/http/HttpRequest.java b/lib/src/main/java/com/github/kevinsawicki/http/HttpRequest.java index d8876ba2..67c1cce9 100644 --- a/lib/src/main/java/com/github/kevinsawicki/http/HttpRequest.java +++ b/lib/src/main/java/com/github/kevinsawicki/http/HttpRequest.java @@ -263,7 +263,7 @@ public class HttpRequest { private static String getValidCharset(final String charset) { if (charset != null && charset.length() > 0) return charset; - else + return CHARSET_UTF8; } @@ -649,7 +649,8 @@ public static byte[] encodeBytesToBytes(byte[] source, int off, int len) { byte[] finalOut = new byte[e]; System.arraycopy(outBuff, 0, finalOut, 0, e); return finalOut; - } else + } + return outBuff; } } @@ -1744,7 +1745,7 @@ protected ByteArrayOutputStream byteStream() { final int size = contentLength(); if (size > 0) return new ByteArrayOutputStream(size); - else + return new ByteArrayOutputStream(); } @@ -2194,7 +2195,7 @@ public String[] headers(final String name) { final List values = headers.get(name); if (values != null && !values.isEmpty()) return values.toArray(new String[values.size()]); - else + return EMPTY_STRINGS; } @@ -2538,7 +2539,8 @@ public HttpRequest contentType(final String contentType, final String charset) { if (charset != null && charset.length() > 0) { final String separator = "; " + PARAM_CHARSET + '='; return header(HEADER_CONTENT_TYPE, contentType + separator + charset); - } else + } + return header(HEADER_CONTENT_TYPE, contentType); }