FIX #64 Hostname failure should be silenced since it's not a mandatory parameter
This commit is contained in:
@@ -173,6 +173,14 @@ public class Server extends Thread implements HostnameVerifier, X509TrustManager
|
|||||||
OS os = OS.getOS();
|
OS os = OS.getOS();
|
||||||
HttpURLConnection connection = null;
|
HttpURLConnection connection = null;
|
||||||
try {
|
try {
|
||||||
|
String hostname;
|
||||||
|
try {
|
||||||
|
hostname = InetAddress.getLocalHost().getHostName();
|
||||||
|
}
|
||||||
|
catch (UnknownHostException e) {
|
||||||
|
this.log.error("Server::getConfiguration failed to get hostname (exception: " + e + ")");
|
||||||
|
hostname = "";
|
||||||
|
}
|
||||||
String url_contents = String.format("%s%s?login=%s&password=%s&cpu_family=%s&cpu_model=%s&cpu_model_name=%s&cpu_cores=%s&os=%s&ram=%s&bits=%s&version=%s&hostname=%s&extras=%s",
|
String url_contents = String.format("%s%s?login=%s&password=%s&cpu_family=%s&cpu_model=%s&cpu_model_name=%s&cpu_cores=%s&os=%s&ram=%s&bits=%s&version=%s&hostname=%s&extras=%s",
|
||||||
this.base_url,
|
this.base_url,
|
||||||
"/server/config.php",
|
"/server/config.php",
|
||||||
@@ -186,7 +194,7 @@ public class Server extends Thread implements HostnameVerifier, X509TrustManager
|
|||||||
os.getMemory(),
|
os.getMemory(),
|
||||||
os.getCPU().arch(),
|
os.getCPU().arch(),
|
||||||
this.user_config.getJarVersion(),
|
this.user_config.getJarVersion(),
|
||||||
URLEncoder.encode(InetAddress.getLocalHost().getHostName(), "UTF-8"),
|
URLEncoder.encode(hostname, "UTF-8"),
|
||||||
this.user_config.getExtras());
|
this.user_config.getExtras());
|
||||||
this.log.debug("Server::getConfiguration url " + url_contents);
|
this.log.debug("Server::getConfiguration url " + url_contents);
|
||||||
|
|
||||||
@@ -256,14 +264,6 @@ public class Server extends Thread implements HostnameVerifier, X509TrustManager
|
|||||||
this.log.error("Server::getConfiguration: exception UnsupportedEncodingException " + e);
|
this.log.error("Server::getConfiguration: exception UnsupportedEncodingException " + e);
|
||||||
return Error.Type.UNKNOWN;
|
return Error.Type.UNKNOWN;
|
||||||
}
|
}
|
||||||
catch (UnknownHostException e) {
|
|
||||||
this.log.error("Server::getConfiguration error UnknownHostException " + e);
|
|
||||||
return Error.Type.NETWORK_ISSUE;
|
|
||||||
}
|
|
||||||
catch (NoRouteToHostException e) {
|
|
||||||
this.log.error("Server::getConfiguration error NoRouteToHost " + e);
|
|
||||||
return Error.Type.NETWORK_ISSUE;
|
|
||||||
}
|
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
this.log.error("Server::getConfiguration: exception IOException " + e);
|
this.log.error("Server::getConfiguration: exception IOException " + e);
|
||||||
return Error.Type.UNKNOWN;
|
return Error.Type.UNKNOWN;
|
||||||
|
|||||||
Reference in New Issue
Block a user