mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
7146776: deadlock between URLStreamHandler.getHostAddress and file.Handler.openconnection
Reviewed-by: alanb, chegar
This commit is contained in:
parent
61292be755
commit
db9c114d40
2 changed files with 30 additions and 20 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1995, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1995, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -443,23 +443,8 @@ public abstract class URLStreamHandler {
|
|||
* IP address.
|
||||
* @since 1.3
|
||||
*/
|
||||
protected synchronized InetAddress getHostAddress(URL u) {
|
||||
if (u.hostAddress != null)
|
||||
return u.hostAddress;
|
||||
|
||||
String host = u.getHost();
|
||||
if (host == null || host.isEmpty()) {
|
||||
return null;
|
||||
} else {
|
||||
try {
|
||||
u.hostAddress = InetAddress.getByName(host);
|
||||
} catch (UnknownHostException ex) {
|
||||
return null;
|
||||
} catch (SecurityException se) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return u.hostAddress;
|
||||
protected InetAddress getHostAddress(URL u) {
|
||||
return u.getHostAddress();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue