8301457: Code in SendPortZero.java is uncommented even after JDK-8236852 was fixed

Reviewed-by: aefimov, msheppar
This commit is contained in:
Michael McMahon 2023-07-24 14:13:44 +00:00
parent 7dd47998f0
commit 298dda4c98
2 changed files with 23 additions and 23 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2023, 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
@ -29,6 +29,7 @@ import org.testng.annotations.Test;
import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetSocketAddress;
import java.net.InetAddress;
import java.net.MulticastSocket;
import java.net.SocketException;
@ -69,7 +70,7 @@ public class SendPortZero {
// Addresses
loopbackAddr = InetAddress.getLoopbackAddress();
//wildcardAddr = new InetSocketAddress(0).getAddress();
wildcardAddr = new InetSocketAddress(0).getAddress();
// Packets
// loopback w/port 0
@ -77,29 +78,30 @@ public class SendPortZero {
loopbackZeroPkt.setAddress(loopbackAddr);
loopbackZeroPkt.setPort(0);
/*
//Commented until JDK-8236852 is fixed
// wildcard w/port 0
wildcardZeroPkt = new DatagramPacket(buf, 0, buf.length);
wildcardZeroPkt.setAddress(wildcardAddr);
wildcardZeroPkt.setPort(0);
//Commented until JDK-8236807 is fixed
// wildcard addr w/valid port
// Not currently tested. See JDK-8236807
wildcardValidPkt = new DatagramPacket(buf, 0, buf.length);
var addr = socket.getAddress();
wildcardValidPkt.setAddress(addr);
wildcardValidPkt.setPort(socket.getLocalPort());
*/
wildcardValidPkt.setAddress(wildcardAddr);
wildcardValidPkt.setPort(datagramSocket.getLocalPort());
}
@DataProvider(name = "data")
public Object[][] variants() {
return new Object[][]{
{ datagramSocket, loopbackZeroPkt },
{ datagramSocket, wildcardZeroPkt },
// Re-enable when JDK-8236807 fixed
//{ datagramSocket, wildcardValidPkt },
{ datagramSocketAdaptor, loopbackZeroPkt },
{ datagramSocketAdaptor, wildcardZeroPkt },
// Re-enable when JDK-8236807 fixed
//{ datagramSocketAdaptor, wildcardValidPkt },
};
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2023, 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
@ -30,6 +30,7 @@ import java.io.IOException;
import java.net.DatagramPacket;
import java.net.MulticastSocket;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.MulticastSocket;
import java.net.SocketException;
import java.net.SocketPermission;
@ -68,7 +69,7 @@ public class SendPortZero {
// Addresses
loopbackAddr = InetAddress.getLoopbackAddress();
//wildcardAddr = new InetSocketAddress(0).getAddress();
wildcardAddr = new InetSocketAddress(0).getAddress();
// Packets
// loopback w/port 0
@ -76,28 +77,25 @@ public class SendPortZero {
loopbackZeroPkt.setAddress(loopbackAddr);
loopbackZeroPkt.setPort(0);
/*
//Commented until JDK-8236852 is fixed
// wildcard w/port 0
wildcardZeroPkt = new DatagramPacket(buf, 0, buf.length);
wildcardZeroPkt.setAddress(wildcardAddr);
wildcardZeroPkt.setPort(0);
//Commented until JDK-8236807 is fixed
// wildcard addr w/valid port
// Not currently tested. See JDK-8236807
wildcardValidPkt = new DatagramPacket(buf, 0, buf.length);
var addr = socket.getAddress();
wildcardValidPkt.setAddress(addr);
wildcardValidPkt.setPort(socket.getLocalPort());
*/
wildcardValidPkt.setAddress(wildcardAddr);
wildcardValidPkt.setPort(multicastSocket.getLocalPort());
}
@DataProvider(name = "data")
public Object[][] variants() {
return new Object[][]{
{ multicastSocket, loopbackZeroPkt }
{ multicastSocket, loopbackZeroPkt },
{ multicastSocket, wildcardZeroPkt },
// Not currently tested. See JDK-8236807
//{ multicastSocket, wildcardValidPkt }
};
}