< prev index next >
src/java.base/share/classes/java/net/SocketPermission.java
Print this page
rev 52979 : 8215281: Use String.isEmpty() when applicable in java.base
Reviewed-by: TBD
@@ -458,11 +458,11 @@
throw new
IllegalArgumentException("invalid host wildcard specification");
}
return;
} else {
- if (host.length() > 0) {
+ if (!host.isEmpty()) {
// see if we are being initialized with an IP address.
char ch = host.charAt(0);
if (ch == ':' || Character.digit(ch, 16) != -1) {
byte ip[] = IPAddressUtil.textToNumericFormatV4(host);
if (ip == null) {
@@ -703,12 +703,11 @@
hdomain = RegisteredDomain.from(b)
.map(RegisteredDomain::name)
.orElse(b);
}
- return cdomain.length() != 0 && hdomain.length() != 0
- && cdomain.equals(hdomain);
+ return !cdomain.isEmpty() && !hdomain.isEmpty() && cdomain.equals(hdomain);
}
private boolean authorized(String cname, byte[] addr) {
if (addr.length == 4)
return authorizedIPv4(cname, addr);
< prev index next >