test_class.file: shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-common/src/test/java/org/apache/shardingsphere/governance/core/utils/IpUtilsTest.java
test_class.identifier: IpUtilsTest
test_case.body: @Test
      public void getIp() {
          assertNotNull(IpUtils.getIp());
      }
test_case.class_method_signature: IpUtilsTest.getIp()
test_case.full_signature: @Test public void getIp()
test_case.identifier: getIp
test_case.invocations: assertNotNull getIp
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void getIp()
focal_class.declarator: cachedIpAddress
focal_class.modifier: private static volatile
focal_class.original_string: private static volatile String cachedIpAddress;
focal_class.type: String
focal_class.var_name: cachedIpAddress
focal_class.file: shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-common/src/main/java/org/apache/shardingsphere/governance/core/utils/IpUtils.java
focal_class.identifier: IpUtils
focal_class.class_method_signature: IpUtils.getIp()
focal_class.full_signature: public static String getIp()
focal_class.identifier: getIp
focal_class.modifiers: public static
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String getIp()
focal_class.class_method_signature: IpUtils.isPublicIpAddress(final InetAddress ipAddress)
focal_class.full_signature: private static boolean isPublicIpAddress(final InetAddress ipAddress)
focal_class.identifier: isPublicIpAddress
focal_class.modifiers: private static
focal_class.parameters: (final InetAddress ipAddress)
focal_class.return: boolean
focal_class.signature: boolean isPublicIpAddress(final InetAddress ipAddress)
focal_class.class_method_signature: IpUtils.isLocalIpAddress(final InetAddress ipAddress)
focal_class.full_signature: private static boolean isLocalIpAddress(final InetAddress ipAddress)
focal_class.identifier: isLocalIpAddress
focal_class.modifiers: private static
focal_class.parameters: (final InetAddress ipAddress)
focal_class.return: boolean
focal_class.signature: boolean isLocalIpAddress(final InetAddress ipAddress)
focal_class.class_method_signature: IpUtils.isV6IpAddress(final InetAddress ipAddress)
focal_class.full_signature: private static boolean isV6IpAddress(final InetAddress ipAddress)
focal_class.identifier: isV6IpAddress
focal_class.modifiers: private static
focal_class.parameters: (final InetAddress ipAddress)
focal_class.return: boolean
focal_class.signature: boolean isV6IpAddress(final InetAddress ipAddress)
focal_method.body: public static String getIp() {
          if (null != cachedIpAddress) {
              return cachedIpAddress;
          }
          Enumeration<NetworkInterface> netInterfaces;
          try {
              netInterfaces = NetworkInterface.getNetworkInterfaces();
          } catch (final SocketException ex) {
              return "UnknownIP";
          }
          String localIpAddress = null;
          while (netInterfaces.hasMoreElements()) {
              NetworkInterface netInterface = netInterfaces.nextElement();
              Enumeration<InetAddress> ipAddresses = netInterface.getInetAddresses();
              while (ipAddresses.hasMoreElements()) {
                  InetAddress ipAddress = ipAddresses.nextElement();
                  if (isPublicIpAddress(ipAddress)) {
                      String publicIpAddress = ipAddress.getHostAddress();
                      cachedIpAddress = publicIpAddress;
                      return publicIpAddress;
                  }
                  if (isLocalIpAddress(ipAddress)) {
                      localIpAddress = ipAddress.getHostAddress();
                  }
              }
          }
          cachedIpAddress = localIpAddress;
          return localIpAddress;
      }
focal_method.class_method_signature: IpUtils.getIp()
focal_method.full_signature: public static String getIp()
focal_method.identifier: getIp
focal_method.invocations: getNetworkInterfaces hasMoreElements nextElement getInetAddresses hasMoreElements nextElement isPublicIpAddress getHostAddress isLocalIpAddress getHostAddress
focal_method.modifiers: public static
focal_method.parameters: ()
focal_method.return: String
focal_method.signature: String getIp()