dbeaver/pro#2176 Localhost IP resolve fix

This commit is contained in:
serge-rider
2023-12-08 13:35:52 +03:00
parent 96a163c50e
commit 43f50f2ff3
@@ -57,6 +57,7 @@ import org.jkiss.utils.SecurityUtils;
import java.io.*;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.nio.charset.StandardCharsets;
import java.sql.*;
import java.util.*;
@@ -458,8 +459,12 @@ public class CBDatabase {
}
private void checkInstanceRecord(Connection connection) throws SQLException, IOException {
InetAddress localHost = InetAddress.getLocalHost();
String hostName = localHost.getHostName();
String hostName;
try {
hostName = InetAddress.getLocalHost().getHostName();
} catch (UnknownHostException e) {
hostName = "localhost";
}
byte[] hardwareAddress = RuntimeUtils.getLocalMacAddress();
String macAddress = CommonUtils.toHexString(hardwareAddress);