RFR 8144672: (ch) PipeImpl should use localhost instead of loopback address
Alan Bateman
Alan.Bateman at oracle.com
Wed Feb 14 07:42:32 UTC 2018
On 14/02/2018 00:09, Brian Burkhalter wrote:
> https://bugs.openjdk.java.net/browse/JDK-8144672
>
> Replace the hard-coded IPv4 loopback address:
>
> --- a/src/java.base/windows/classes/sun/nio/ch/PipeImpl.java
> +++ b/src/java.base/windows/classes/sun/nio/ch/PipeImpl.java
> @@ -110,7 +110,7 @@
> ByteBuffer bb = ByteBuffer.allocate(NUM_SECRET_BYTES);
>
> // Loopback address
> - InetAddress lb = InetAddress.getByName("127.0.0.1");
> + InetAddress lb = InetAddress.getLoopbackAddress();
> assert(lb.isLoopbackAddress());
>
>
This looks okay to me.
(I don't get Martin's comment about using getHostAddress, maybe useful
for tests but you need an InetAddress here, not a String).
-Alan
More information about the nio-dev
mailing list