< prev index next >

src/java.base/share/classes/java/net/URL.java

Print this page
rev 52979 : 8215281: Use String.isEmpty() when applicable in java.base
Reviewed-by: TBD

*** 1511,1521 **** String authority = (String)gf.get("authority", null); String file = (String)gf.get("file", null); String ref = (String)gf.get("ref", null); int hashCode = gf.get("hashCode", -1); if (authority == null ! && ((host != null && host.length() > 0) || port != -1)) { if (host == null) host = ""; authority = (port == -1) ? host : host + ":" + port; } tempState = new UrlDeserializedState(protocol, host, port, authority, --- 1511,1521 ---- String authority = (String)gf.get("authority", null); String file = (String)gf.get("file", null); String ref = (String)gf.get("ref", null); int hashCode = gf.get("hashCode", -1); if (authority == null ! && ((host != null && !host.isEmpty()) || port != -1)) { if (host == null) host = ""; authority = (port == -1) ? host : host + ":" + port; } tempState = new UrlDeserializedState(protocol, host, port, authority,
*** 1558,1568 **** int hashCode = tempState.getHashCode(); // Construct authority part if (authority == null ! && ((host != null && host.length() > 0) || port != -1)) { if (host == null) host = ""; authority = (port == -1) ? host : host + ":" + port; // Handle hosts with userInfo in them --- 1558,1568 ---- int hashCode = tempState.getHashCode(); // Construct authority part if (authority == null ! && ((host != null && !host.isEmpty()) || port != -1)) { if (host == null) host = ""; authority = (port == -1) ? host : host + ":" + port; // Handle hosts with userInfo in them
*** 1714,1734 **** String reconstituteUrlString() { // pre-compute length of StringBuffer int len = protocol.length() + 1; ! if (authority != null && authority.length() > 0) len += 2 + authority.length(); if (file != null) { len += file.length(); } if (ref != null) len += 1 + ref.length(); StringBuilder result = new StringBuilder(len); result.append(protocol); result.append(":"); ! if (authority != null && authority.length() > 0) { result.append("//"); result.append(authority); } if (file != null) { result.append(file); --- 1714,1734 ---- String reconstituteUrlString() { // pre-compute length of StringBuffer int len = protocol.length() + 1; ! if (authority != null && !authority.isEmpty()) len += 2 + authority.length(); if (file != null) { len += file.length(); } if (ref != null) len += 1 + ref.length(); StringBuilder result = new StringBuilder(len); result.append(protocol); result.append(":"); ! if (authority != null && !authority.isEmpty()) { result.append("//"); result.append(authority); } if (file != null) { result.append(file);
< prev index next >