]> source.dussan.org Git - sonarqube.git/commitdiff
Refactor the way to get loopback address in CeHttpServer
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Mon, 3 Apr 2017 11:45:04 +0000 (13:45 +0200)
committerSimon Brandhof <simon.brandhof@sonarsource.com>
Tue, 11 Apr 2017 18:48:58 +0000 (20:48 +0200)
server/sonar-ce/src/main/java/org/sonar/ce/httpd/CeHttpServer.java

index fd9138c627fe7f595cc4eb2932fe70e977a0e66a..3a8f28fb4a450dbf39b6010ca2d1fa409237b100 100644 (file)
@@ -23,7 +23,6 @@ import fi.iki.elonen.NanoHTTPD;
 import java.io.File;
 import java.io.IOException;
 import java.net.InetAddress;
-import java.net.UnknownHostException;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Locale;
@@ -54,12 +53,11 @@ public class CeHttpServer {
   private final ActionRegistryImpl actionRegistry;
   private final CeNanoHttpd nanoHttpd;
 
-  public CeHttpServer(Properties processProps, List<HttpAction> actions) throws UnknownHostException {
+  public CeHttpServer(Properties processProps, List<HttpAction> actions) {
     this.processProps = processProps;
     this.actions = actions;
     this.actionRegistry = new ActionRegistryImpl();
-    InetAddress loopbackAddress = InetAddress.getByName(null);
-    this.nanoHttpd = new CeNanoHttpd(loopbackAddress.getHostAddress(), 0, actionRegistry);
+    this.nanoHttpd = new CeNanoHttpd(InetAddress.getLoopbackAddress().getHostAddress(), 0, actionRegistry);
   }
 
   // do not rename. This naming convention is required for picocontainer.