RFR: 8313997: The jdi/ListeningConnector/startListening/startlis001 may fail if the hosts file is modified
Sergey Bylokhov
serb at openjdk.org
Wed Aug 9 16:26:00 UTC 2023
The test uses this code to create a list of valid addresses for the localhost:
String hostname = "localhost";
List<String> validAddresses = new LinkedList<>();
validAddresses.add(hostname);
Arrays.stream(InetAddress.getAllByName(hostname))
.forEach(address -> validAddresses.add(address.getHostAddress()));
It does not work properly if the custom name is set for the 127.0.01 via /etc/hosts file. In that case, the address returned by the "startListen()" will be "SomeCustomName:port", for example we can return it here:
https://github.com/openjdk/jdk/blob/360f65d7b15b327e2f160c42f318945cc6548bda/src/jdk.jdi/share/classes/com/sun/tools/jdi/SocketTransportService.java#L82
-------------
Commit messages:
- 8313997: The jdi/ListeningConnector/startListening/startlis001 may fail if the hosts file is modified
Changes: https://git.openjdk.org/jdk/pull/15203/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=15203&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8313997
Stats: 19 lines in 1 file changed: 12 ins; 3 del; 4 mod
Patch: https://git.openjdk.org/jdk/pull/15203.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/15203/head:pull/15203
PR: https://git.openjdk.org/jdk/pull/15203
More information about the serviceability-dev
mailing list