mdedetrich opened a new pull request #11478: URL: https://github.com/apache/kafka/pull/11478
Loosens the validation so that we accept duplicate listeners on the same port but if and only if the listeners are valid IP addresses with one address being an IPv4 address and the other being an IPv6 address. The detection of whether an address is a valid IP/IPv4/IPv6 address is done using Apache's commons-validator. Outside of this specific case the validations are kept the same albeit error messages have been updated to reflect that there is this new exception case of accepting IPv4/IPv6 on the same port. This PR tests different corner cases by checking whether the changed `listenerListToEndPoints` either throws an exception or not. There is a good argument that the testing can be done better by using specific classes for the different types of exceptions, i.e. ```scala class EachListenerDifferentPort(listeners: String) extends IllegalArgumentException { override def getMessage: String = s"Each listener must have a different port, listeners: $listeners" } ``` And then add a new version of `require` that allows us to throw a specific class that extends exception so that we can actually check each specific case, i.e. ```scala assertThrows(classOf[EachListenerDifferentPort], () => listenerListToEndPoints("PLAINTEXT://127.0.0.1:9092,PLAINTEXT://127.0.0.1:9092,PLAINTEXT://127.0.0.1:9092") ) ``` If you want this to be done then please let me know. ### Committer Checklist (excluded from commit message) - [ ] Verify design and implementation - [ ] Verify test coverage and CI build status - [ ] Verify documentation (including upgrade notes) -- 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. To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org