8214971: Replace use of string.equals("") with isEmpty()

Reviewed-by: jlaskey, prappo, lancea, dfuchs, redestad
This commit is contained in:
Roger Riggs 2018-12-07 11:51:17 -05:00
parent df5b42f33b
commit 938b844088
95 changed files with 195 additions and 195 deletions

View file

@ -201,13 +201,13 @@ class Http1Request {
private String getPathAndQuery(URI uri) {
String path = uri.getRawPath();
String query = uri.getRawQuery();
if (path == null || path.equals("")) {
if (path == null || path.isEmpty()) {
path = "/";
}
if (query == null) {
query = "";
}
if (query.equals("")) {
if (query.isEmpty()) {
return Utils.encode(path);
} else {
return Utils.encode(path + "?" + query);

View file

@ -190,7 +190,7 @@ public class HttpRequestBuilderImpl implements HttpRequest.Builder {
@Override
public HttpRequest.Builder method(String method, BodyPublisher body) {
requireNonNull(method);
if (method.equals(""))
if (method.isEmpty())
throw newIAE("illegal method <empty string>");
if (method.equals("CONNECT"))
throw newIAE("method CONNECT is not supported");
@ -205,7 +205,7 @@ public class HttpRequestBuilderImpl implements HttpRequest.Builder {
private HttpRequest.Builder method0(String method, BodyPublisher body) {
assert method != null;
assert !method.equals("");
assert !method.isEmpty();
this.method = method;
this.bodyPublisher = body;
return this;

View file

@ -84,7 +84,7 @@ class ResponseContent {
if (contentLength == -1) {
String tc = headers.firstValue("Transfer-Encoding")
.orElse("");
if (!tc.equals("")) {
if (!tc.isEmpty()) {
if (tc.equalsIgnoreCase("chunked")) {
chunkedContent = true;
} else {

View file

@ -97,7 +97,7 @@ public class SSLFlowDelegate {
private static final ByteBuffer NOTHING = ByteBuffer.allocate(0);
private static final String monProp = Utils.getProperty("jdk.internal.httpclient.monitorFlowDelegate");
private static final boolean isMonitored =
monProp != null && (monProp.equals("") || monProp.equalsIgnoreCase("true"));
monProp != null && (monProp.isEmpty() || monProp.equalsIgnoreCase("true"));
final Executor exec;
final Reader reader;