mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8215281: Use String.isEmpty() when applicable in java.base
Reviewed-by: dfuchs, alanb
This commit is contained in:
parent
c998ead188
commit
a3df1d618e
155 changed files with 340 additions and 382 deletions
|
@ -1513,7 +1513,7 @@ public final class URL implements java.io.Serializable {
|
|||
String ref = (String)gf.get("ref", null);
|
||||
int hashCode = gf.get("hashCode", -1);
|
||||
if (authority == null
|
||||
&& ((host != null && host.length() > 0) || port != -1)) {
|
||||
&& ((host != null && !host.isEmpty()) || port != -1)) {
|
||||
if (host == null)
|
||||
host = "";
|
||||
authority = (port == -1) ? host : host + ":" + port;
|
||||
|
@ -1560,7 +1560,7 @@ public final class URL implements java.io.Serializable {
|
|||
|
||||
// Construct authority part
|
||||
if (authority == null
|
||||
&& ((host != null && host.length() > 0) || port != -1)) {
|
||||
&& ((host != null && !host.isEmpty()) || port != -1)) {
|
||||
if (host == null)
|
||||
host = "";
|
||||
authority = (port == -1) ? host : host + ":" + port;
|
||||
|
@ -1716,7 +1716,7 @@ final class UrlDeserializedState {
|
|||
|
||||
// pre-compute length of StringBuffer
|
||||
int len = protocol.length() + 1;
|
||||
if (authority != null && authority.length() > 0)
|
||||
if (authority != null && !authority.isEmpty())
|
||||
len += 2 + authority.length();
|
||||
if (file != null) {
|
||||
len += file.length();
|
||||
|
@ -1726,7 +1726,7 @@ final class UrlDeserializedState {
|
|||
StringBuilder result = new StringBuilder(len);
|
||||
result.append(protocol);
|
||||
result.append(":");
|
||||
if (authority != null && authority.length() > 0) {
|
||||
if (authority != null && !authority.isEmpty()) {
|
||||
result.append("//");
|
||||
result.append(authority);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue