NIFI-4761 Fixing test case regression.

This closes #2418.

Signed-off-by: Andy LoPresto <alopresto@apache.org>
This commit is contained in:
Matt Gilman 2018-01-19 12:42:47 -05:00 committed by Andy LoPresto
parent a3ddb3b4fa
commit e3c661daac
No known key found for this signature in database
GPG Key ID: 6EC293152D90B61D
1 changed files with 10 additions and 5 deletions

View File

@ -70,15 +70,20 @@ public class HostHeaderHandler extends ScopedHandler {
this.serverName = Objects.requireNonNull(serverName); this.serverName = Objects.requireNonNull(serverName);
this.serverPort = serverPort; this.serverPort = serverPort;
// Default values across generic instances
validHosts = generateDefaultHostnames(null); validHosts = generateDefaultHostnames(null);
// specified host:port
validHosts.add(serverName.toLowerCase()); validHosts.add(serverName.toLowerCase());
validHosts.add(serverName.toLowerCase() + ":" + serverPort); validHosts.add(serverName.toLowerCase() + ":" + serverPort);
// Sometimes the hostname is left empty but the port is always populated
// empty is ok here validHosts.add("localhost");
validHosts.add("localhost:" + serverPort);
// Different from customizer -- empty is ok here
validHosts.add(""); validHosts.add("");
try {
validHosts.add(InetAddress.getLocalHost().getHostName().toLowerCase());
validHosts.add(InetAddress.getLocalHost().getHostName().toLowerCase() + ":" + serverPort);
} catch (final Exception e) {
logger.warn("Failed to determine local hostname.", e);
}
logger.info("Created " + this.toString()); logger.info("Created " + this.toString());
} }