dbeaver/pro#2176 Localhost domain name resolve fix

This commit is contained in:
serge-rider
2023-12-08 07:47:35 +03:00
parent 36061a03c4
commit 96a163c50e
@@ -557,7 +557,12 @@ public abstract class CBApplication extends BaseWebApplication implements WebAut
} else if (serverURL == null) {
String hostName = serverHost;
if (CommonUtils.isEmpty(hostName)) {
hostName = InetAddress.getLocalHost().getHostName();
try {
hostName = InetAddress.getLocalHost().getHostName();
} catch (UnknownHostException e) {
log.debug("Error resolving localhost address: " + e.getMessage());
hostName = "localhost";
}
}
serverURL = "http://" + hostName + ":" + serverPort;
}
@@ -604,7 +609,7 @@ public abstract class CBApplication extends BaseWebApplication implements WebAut
}
}
parseAdditionalConfiguration(configProps);
} catch (IOException | DBException e) {
} catch (DBException e) {
throw new DBException("Error parsing server configuration", e);
}