tombentley commented on a change in pull request #10530: URL: https://github.com/apache/kafka/pull/10530#discussion_r616833243
########## File path: connect/runtime/src/main/java/org/apache/kafka/connect/runtime/rest/RestServer.java ########## @@ -369,9 +370,34 @@ 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. + */ + static void validateUriHost(URI uri) { + //java URI parsing will fail silently returning null in the host if the host name contains invalid characters like _ + //this bubbles up later when the Herder tries to communicate on the advertised url and the current HttpClient fails with an ambiguous message + //we need to revisit this when we upgrade to a better HttpClient that can communicate with such host names or throws a better error message Review comment: The place for plans for future changes is JIRA. Statements about changes which may or may not happen in the future means the comment could become stale (in this case when the client does get changed), or at least means someone has to know to amend the comment when the client does change. So best drop the last line imo. -- 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