diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/WebserviceInfo.java b/src/main/java/ch/ethz/seb/sebserver/webservice/WebserviceInfo.java index 6745b1d0..ed47e517 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/WebserviceInfo.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/WebserviceInfo.java @@ -201,7 +201,8 @@ public class WebserviceInfo { try { return InetAddress.getLocalHost().getHostName(); } catch (final UnknownHostException e) { - return null; + log.error("Failed to get local host name: {}", e.getMessage()); + return Constants.EMPTY_NOTE; } } @@ -209,7 +210,8 @@ public class WebserviceInfo { try { return InetAddress.getLocalHost().getHostAddress(); } catch (final UnknownHostException e) { - return null; + log.error("Failed to get local host address: {}", e.getMessage()); + return Constants.EMPTY_NOTE; } } diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/WebserviceInit.java b/src/main/java/ch/ethz/seb/sebserver/webservice/WebserviceInit.java index b863ca27..029da1e2 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/WebserviceInit.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/WebserviceInit.java @@ -8,9 +8,6 @@ package ch.ethz.seb.sebserver.webservice; -import java.net.InetAddress; -import java.net.UnknownHostException; - import javax.annotation.PreDestroy; import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; @@ -126,21 +123,15 @@ public class WebserviceInit implements ApplicationListener "); - SEBServerInit.INIT_LOGGER.info("----> Server address: {}", this.environment.getProperty("server.address")); - SEBServerInit.INIT_LOGGER.info("----> Server port: {}", this.environment.getProperty("server.port")); - SEBServerInit.INIT_LOGGER.info("---->"); - SEBServerInit.INIT_LOGGER.info("----> Local-Host address: {}", InetAddress.getLocalHost().getHostAddress()); - SEBServerInit.INIT_LOGGER.info("----> Local-Host name: {}", InetAddress.getLocalHost().getHostName()); - SEBServerInit.INIT_LOGGER.info("---->"); - SEBServerInit.INIT_LOGGER.info("----> Remote-Host address: {}", - InetAddress.getLoopbackAddress().getHostAddress()); - SEBServerInit.INIT_LOGGER.info("----> Remote-Host name: {}", - InetAddress.getLoopbackAddress().getHostName()); - } catch (final UnknownHostException e) { - SEBServerInit.INIT_LOGGER.error("Unknown Host: ", e); - } + SEBServerInit.INIT_LOGGER.info("----> "); + SEBServerInit.INIT_LOGGER.info("----> Server address: {}", this.environment.getProperty("server.address")); + SEBServerInit.INIT_LOGGER.info("----> Server port: {}", this.environment.getProperty("server.port")); + SEBServerInit.INIT_LOGGER.info("---->"); + SEBServerInit.INIT_LOGGER.info("----> Local-Host address: {}", this.webserviceInfo.getLocalHostAddress()); + SEBServerInit.INIT_LOGGER.info("----> Local-Host name: {}", this.webserviceInfo.getLocalHostName()); + SEBServerInit.INIT_LOGGER.info("---->"); + SEBServerInit.INIT_LOGGER.info("----> Remote-Host address: {}", this.webserviceInfo.getLoopbackHostAddress()); + SEBServerInit.INIT_LOGGER.info("----> Remote-Host name: {}", this.webserviceInfo.getLoopbackHostName()); SEBServerInit.INIT_LOGGER.info("---->"); SEBServerInit.INIT_LOGGER.info("----> Context Path: {}", this.webserviceInfo.getContextPath()); @@ -162,7 +153,7 @@ public class WebserviceInit implements ApplicationListener Successfully register Webservice instance. uuid: {}, address: {}",