src/java.base/share/classes/java/net/SocketPermission.java
changeset 53018 8bf9268df0e2
parent 52902 e3398b2e1ab0
child 57956 e0b8b019d2f5
child 58678 9cf78a70fa4f
equal deleted inserted replaced
53017:e10a1f7aaa13 53018:8bf9268df0e2
   458               throw new
   458               throw new
   459                IllegalArgumentException("invalid host wildcard specification");
   459                IllegalArgumentException("invalid host wildcard specification");
   460             }
   460             }
   461             return;
   461             return;
   462         } else {
   462         } else {
   463             if (host.length() > 0) {
   463             if (!host.isEmpty()) {
   464                 // see if we are being initialized with an IP address.
   464                 // see if we are being initialized with an IP address.
   465                 char ch = host.charAt(0);
   465                 char ch = host.charAt(0);
   466                 if (ch == ':' || Character.digit(ch, 16) != -1) {
   466                 if (ch == ':' || Character.digit(ch, 16) != -1) {
   467                     byte ip[] = IPAddressUtil.textToNumericFormatV4(host);
   467                     byte ip[] = IPAddressUtil.textToNumericFormatV4(host);
   468                     if (ip == null) {
   468                     if (ip == null) {
   703             hdomain = RegisteredDomain.from(b)
   703             hdomain = RegisteredDomain.from(b)
   704                                       .map(RegisteredDomain::name)
   704                                       .map(RegisteredDomain::name)
   705                                       .orElse(b);
   705                                       .orElse(b);
   706         }
   706         }
   707 
   707 
   708         return cdomain.length() != 0 && hdomain.length() != 0
   708         return !cdomain.isEmpty() && !hdomain.isEmpty() && cdomain.equals(hdomain);
   709                         && cdomain.equals(hdomain);
       
   710     }
   709     }
   711 
   710 
   712     private boolean authorized(String cname, byte[] addr) {
   711     private boolean authorized(String cname, byte[] addr) {
   713         if (addr.length == 4)
   712         if (addr.length == 4)
   714             return authorizedIPv4(cname, addr);
   713             return authorizedIPv4(cname, addr);