NOTICK: Fix potential infinite loop when a SecurityManager is installed. (#5993)

This commit is contained in:
Chris Rankin 2020-02-24 09:36:16 +00:00 committed by GitHub
parent b3ca720412
commit d2568b9077
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -86,7 +86,10 @@ class SharedMemoryIncremental extends PortAllocation {
private boolean isLocalPortAvailable(Long portToTest) {
try (ServerSocket serverSocket = new ServerSocket(Math.toIntExact(portToTest))) {
} catch (Exception e) {
} catch (IOException e) {
// Don't catch anything other than IOException here in case we
// accidentally create an infinite loop. For example, installing
// a SecurityManager could throw AccessControlException.
return false;
}
return true;