HBASE-24197 TestHttpServer.testBindAddress failure with latest jetty (#1524)

use the findPort logic even if the BindException is wrapped in an IOException

Signed-off-by: Viraj Jasani <vjasani@apache.org>
Signed-off-by: Jan Hentschel <jan.hentschel@ultratendency.com>
Signed-off-by: Peter Somogyi <psomogyi@apache.org>
This commit is contained in:
Istvan Toth 2020-04-16 11:51:59 +02:00 committed by Peter Somogyi
parent 360baf9dd6
commit ec266a0743
1 changed files with 4 additions and 1 deletions

View File

@ -1120,7 +1120,10 @@ public class HttpServer implements FilterContainer {
listener.open();
LOG.info("Jetty bound to port " + listener.getLocalPort());
break;
} catch (BindException ex) {
} catch (IOException ex) {
if(!(ex instanceof BindException) && !(ex.getCause() instanceof BindException)) {
throw ex;
}
if (port == 0 || !findPort) {
BindException be = new BindException("Port in use: "
+ listener.getHost() + ":" + listener.getPort());