public static String transformToIPv6(String ipv4) {
    if (NetUtil.isValidIpV4Address(ipv4)) {
      try {
        return InetAddress.getByName("::ffff:" + ipv4).getHostAddress();
      } catch (UnknownHostException e) {
        throw new RuntimeException(e);
      }
    } else {
      return ipv4;
    }
  }
If the provided address is an IPv4 address, transforms it to IPv6, otherwise returns the provided address.
Used in some tests which use hardcoded IPv4 addresses that need to be IPv6 when active stack is IPv6.
@param ipv4 An IPv4 address
@return the transformed IPv4 address
standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/common/IPStackUtils.java