tombentley commented on a change in pull request #10530: URL: https://github.com/apache/kafka/pull/10530#discussion_r612219113
########## File path: connect/runtime/src/main/java/org/apache/kafka/connect/runtime/rest/RestServer.java ########## @@ -369,9 +370,31 @@ else if (serverConnector != null && serverConnector.getHost() != null && serverC else if (serverConnector != null && serverConnector.getPort() > 0) builder.port(serverConnector.getPort()); - log.info("Advertised URI: {}", builder.build()); + URI uri = builder.build(); + validateUriHost(uri); + log.info("Advertised URI: {}", uri); - return builder.build(); + return uri; + } + + /** + * Parses the uri and throws a more definitive error + * when the internal node to node communication can't happen due to an invalid host name. + */ + private void validateUriHost(URI uri) { + if (uri.getHost() == null) { + String host = Utils.getHost(uri.getAuthority()); Review comment: Why use `Utils.getHost()` rather than `uri.getHost()`? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org