< prev index next >

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

Print this page
*** 1214,29 ***
                  throws UnknownHostException {
              Objects.requireNonNull(host);
              Objects.requireNonNull(policy);
              validate(host);
              InetAddress[] addrs;
!             long comp = Blocker.begin();
              try {
                  addrs = impl.lookupAllHostAddr(host, policy);
              } finally {
!                 Blocker.end(comp);
              }
              return Arrays.stream(addrs);
          }
  
          public String lookupByAddress(byte[] addr) throws UnknownHostException {
              Objects.requireNonNull(addr);
              if (addr.length != Inet4Address.INADDRSZ && addr.length != Inet6Address.INADDRSZ) {
                  throw new IllegalArgumentException("Invalid address length");
              }
!             long comp = Blocker.begin();
              try {
                  return impl.getHostByAddr(addr);
              } finally {
!                 Blocker.end(comp);
              }
          }
      }
  
      /**
--- 1214,29 ---
                  throws UnknownHostException {
              Objects.requireNonNull(host);
              Objects.requireNonNull(policy);
              validate(host);
              InetAddress[] addrs;
!             boolean attempted = Blocker.begin();
              try {
                  addrs = impl.lookupAllHostAddr(host, policy);
              } finally {
!                 Blocker.end(attempted);
              }
              return Arrays.stream(addrs);
          }
  
          public String lookupByAddress(byte[] addr) throws UnknownHostException {
              Objects.requireNonNull(addr);
              if (addr.length != Inet4Address.INADDRSZ && addr.length != Inet6Address.INADDRSZ) {
                  throw new IllegalArgumentException("Invalid address length");
              }
!             boolean attempted = Blocker.begin();
              try {
                  return impl.getHostByAddr(addr);
              } finally {
!                 Blocker.end(attempted);
              }
          }
      }
  
      /**
< prev index next >