From 4627365b3e53b2084a57780a3af915ee76a8ef52 Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Mon, 3 Apr 2017 13:45:04 +0200 Subject: [PATCH] Refactor the way to get loopback address in CeHttpServer --- .../src/main/java/org/sonar/ce/httpd/CeHttpServer.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/server/sonar-ce/src/main/java/org/sonar/ce/httpd/CeHttpServer.java b/server/sonar-ce/src/main/java/org/sonar/ce/httpd/CeHttpServer.java index fd9138c627f..3a8f28fb4a4 100644 --- a/server/sonar-ce/src/main/java/org/sonar/ce/httpd/CeHttpServer.java +++ b/server/sonar-ce/src/main/java/org/sonar/ce/httpd/CeHttpServer.java @@ -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 actions) throws UnknownHostException { + public CeHttpServer(Properties processProps, List 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. -- 2.39.5