< prev index next >

src/java.net.http/share/classes/jdk/internal/net/http/HttpRequestBuilderImpl.java

Print this page
rev 52881 : 8214971: Replace use of string.equals("") with isEmpty()
Reviewed-by: jlaskey, prappo, lancea, dfuchs, redestad

*** 188,198 **** } @Override public HttpRequest.Builder method(String method, BodyPublisher body) { requireNonNull(method); ! if (method.equals("")) throw newIAE("illegal method <empty string>"); if (method.equals("CONNECT")) throw newIAE("method CONNECT is not supported"); if (!Utils.isValidName(method)) throw newIAE("illegal method \"" --- 188,198 ---- } @Override public HttpRequest.Builder method(String method, BodyPublisher body) { requireNonNull(method); ! if (method.isEmpty()) throw newIAE("illegal method <empty string>"); if (method.equals("CONNECT")) throw newIAE("method CONNECT is not supported"); if (!Utils.isValidName(method)) throw newIAE("illegal method \""
*** 203,213 **** return method0(method, requireNonNull(body)); } private HttpRequest.Builder method0(String method, BodyPublisher body) { assert method != null; ! assert !method.equals(""); this.method = method; this.bodyPublisher = body; return this; } --- 203,213 ---- return method0(method, requireNonNull(body)); } private HttpRequest.Builder method0(String method, BodyPublisher body) { assert method != null; ! assert !method.isEmpty(); this.method = method; this.bodyPublisher = body; return this; }
< prev index next >