< prev index next >

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

Print this page
rev 51919 : 8215281: Use String.isEmpty() when applicable in java.base
Reviewed-by: dfuchs, alanb

*** 458,468 **** throw new IllegalArgumentException("invalid host wildcard specification"); } return; } else { ! if (host.length() > 0) { // 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) { --- 458,468 ---- throw new IllegalArgumentException("invalid host wildcard specification"); } return; } else { ! 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,714 **** hdomain = RegisteredDomain.from(b) .map(RegisteredDomain::name) .orElse(b); } ! return cdomain.length() != 0 && hdomain.length() != 0 ! && cdomain.equals(hdomain); } private boolean authorized(String cname, byte[] addr) { if (addr.length == 4) return authorizedIPv4(cname, addr); --- 703,713 ---- hdomain = RegisteredDomain.from(b) .map(RegisteredDomain::name) .orElse(b); } ! 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 >