(cherry picked from commit 8a58a12626f0332a4a828f312e2007d8c23564ee) (cherry picked from commit d2ecaf217fcde5f900262ef156df9cee5de950d7)
@@ -1280,7 +1280,11 @@ public final class HttpServer2 implements FilterContainer {
try {
bindListener(listener);
return;
- } catch (BindException ex) {
+ } catch (IOException ex) {
+ if (!(ex instanceof BindException)
+ && !(ex.getCause() instanceof BindException)) {
+ throw ex;
+ }
// Ignore exception. Move to next port.
ioException = ex;
}