8215281: Use String.isEmpty() when applicable in java.base

Reviewed-by: dfuchs, alanb
This commit is contained in:
Claes Redestad 2018-12-13 15:31:05 +01:00
parent c998ead188
commit a3df1d618e
155 changed files with 340 additions and 382 deletions

View file

@ -1959,10 +1959,8 @@ public final class URI
throws URISyntaxException
{
if (scheme != null) {
if ((path != null)
&& ((path.length() > 0) && (path.charAt(0) != '/')))
throw new URISyntaxException(s,
"Relative path in absolute URI");
if (path != null && !path.isEmpty() && path.charAt(0) != '/')
throw new URISyntaxException(s, "Relative path in absolute URI");
}
}
@ -2163,7 +2161,7 @@ public final class URI
ru.port = base.port;
String cp = (child.path == null) ? "" : child.path;
if ((cp.length() > 0) && (cp.charAt(0) == '/')) {
if (!cp.isEmpty() && cp.charAt(0) == '/') {
// 5.2 (5): Child path is absolute
ru.path = child.path;
} else {
@ -2187,7 +2185,7 @@ public final class URI
// o.w., return a new URI containing the normalized path.
//
private static URI normalize(URI u) {
if (u.isOpaque() || (u.path == null) || (u.path.length() == 0))
if (u.isOpaque() || u.path == null || u.path.isEmpty())
return u;
String np = normalize(u.path);