8223652: Rename IPSupport.skipIfCurrentConfigurationIsInvalid() to IPSupport.throwSkippedExceptionIfNonOperational()

Reviewed-by: dfuchs, chegar
This commit is contained in:
Arthur Eubanks 2019-05-09 10:28:29 -07:00 committed by Arthur Eubanks
parent a5c506b411
commit eff53ce5e9
52 changed files with 63 additions and 53 deletions

View File

@ -106,7 +106,7 @@ public class UnreferencedDatagramSockets {
}
public static void main(String args[]) throws Exception {
IPSupport.skipIfCurrentConfigurationIsInvalid();
IPSupport.throwSkippedExceptionIfNonOperational();
// Create and close a DatagramSocket to warm up the FD count for side effects.
try (DatagramSocket s = new DatagramSocket(0)) {

View File

@ -34,7 +34,7 @@ import jdk.test.lib.net.IPSupport;
public class MinimumPermissions {
public static void main(String[] args) {
IPSupport.skipIfCurrentConfigurationIsInvalid();
IPSupport.throwSkippedExceptionIfNonOperational();
}
}

View File

@ -48,7 +48,7 @@ public class PingThis {
if (System.getProperty("os.name").startsWith("Windows")) {
return;
}
IPSupport.skipIfCurrentConfigurationIsInvalid();
IPSupport.throwSkippedExceptionIfNonOperational();
List<String> addrs = new ArrayList<String>();

View File

@ -44,7 +44,7 @@ import jdk.test.lib.net.IPSupport;
public class GetLocalHostWithSM {
public static void main(String[] args) throws Exception {
IPSupport.skipIfCurrentConfigurationIsInvalid();
IPSupport.throwSkippedExceptionIfNonOperational();
// try setting the local hostname
InetAddress localHost = InetAddress.getLocalHost();

View File

@ -43,7 +43,7 @@ import jdk.test.lib.net.IPSupport;
public class JoinLeave {
public static void main(String args[]) throws IOException {
IPSupport.skipIfCurrentConfigurationIsInvalid();
IPSupport.throwSkippedExceptionIfNonOperational();
InetAddress ip4Group = InetAddress.getByName("224.80.80.80");
InetAddress ip6Group = InetAddress.getByName("ff02::a");

View File

@ -115,7 +115,7 @@ public class Promiscuous {
}
public static void main(String args[]) throws IOException {
IPSupport.skipIfCurrentConfigurationIsInvalid();
IPSupport.throwSkippedExceptionIfNonOperational();
String os = System.getProperty("os.name");

View File

@ -42,7 +42,7 @@ import jdk.test.lib.net.IPSupport;
public class SetGetNetworkInterfaceTest {
public static void main(String[] args) throws Exception {
IPSupport.skipIfCurrentConfigurationIsInvalid();
IPSupport.throwSkippedExceptionIfNonOperational();
NetworkConfiguration nc = NetworkConfiguration.probe();
try (MulticastSocket ms = new MulticastSocket()) {
nc.multicastInterfaces(true).forEach(nif -> setGetNetworkInterface(ms, nif));

View File

@ -159,7 +159,7 @@ public class Test {
}
public static void main(String args[]) throws Exception {
IPSupport.skipIfCurrentConfigurationIsInvalid();
IPSupport.throwSkippedExceptionIfNonOperational();
Test t = new Test();

View File

@ -107,7 +107,7 @@ public class UnreferencedMulticastSockets {
}
public static void main(String args[]) throws Exception {
IPSupport.skipIfCurrentConfigurationIsInvalid();
IPSupport.throwSkippedExceptionIfNonOperational();
// Create and close a MulticastSocket to warm up the FD count for side effects.
try (MulticastSocket s = new MulticastSocket(0)) {

View File

@ -52,7 +52,7 @@ public class NetworkInterfaceStreamTest extends OpTestCase {
@BeforeTest
void setup() {
IPSupport.skipIfCurrentConfigurationIsInvalid();
IPSupport.throwSkippedExceptionIfNonOperational();
}
@Test

View File

@ -37,7 +37,7 @@ public class Test {
static final boolean isWindows = System.getProperty("os.name").startsWith("Windows");
public static void main(String args[]) throws Exception {
IPSupport.skipIfCurrentConfigurationIsInvalid();
IPSupport.throwSkippedExceptionIfNonOperational();
Enumeration nifs = NetworkInterface.getNetworkInterfaces();

View File

@ -110,7 +110,7 @@ public class UnreferencedSockets {
}
public static void main(String args[]) throws Exception {
IPSupport.skipIfCurrentConfigurationIsInvalid();
IPSupport.throwSkippedExceptionIfNonOperational();
// Create and close a ServerSocket to warm up the FD count for side effects.
try (ServerSocket s = new ServerSocket(0)) {

View File

@ -155,7 +155,7 @@ public class AddressTest {
}
public static void main(String[] args) throws Exception {
IPSupport.skipIfCurrentConfigurationIsInvalid();
IPSupport.throwSkippedExceptionIfNonOperational();
new AddressTest();
}
}

View File

@ -37,7 +37,7 @@ import jdk.test.lib.net.IPSupport;
public class B6210227 {
public static void main(String[] args) throws Exception
{
IPSupport.skipIfCurrentConfigurationIsInvalid();
IPSupport.throwSkippedExceptionIfNonOperational();
ServerSocket ss = new ServerSocket(0);
int port = ss.getLocalPort();

View File

@ -38,7 +38,7 @@ import jdk.test.lib.net.IPSupport;
public class CloseAvailable {
public static void main(String[] args) throws Exception {
IPSupport.skipIfCurrentConfigurationIsInvalid();
IPSupport.throwSkippedExceptionIfNonOperational();
testClose();

View File

@ -37,7 +37,7 @@ import jdk.test.lib.net.IPSupport;
public class DeadlockTest {
public static void main(String [] argv) throws Exception {
IPSupport.skipIfCurrentConfigurationIsInvalid();
IPSupport.throwSkippedExceptionIfNonOperational();
ServerSocket ss = new ServerSocket(0);
Socket clientSocket = new Socket();

View File

@ -41,7 +41,7 @@ public class GetLocalAddress implements Runnable {
static int port;
public static void main(String args[]) throws Exception {
IPSupport.skipIfCurrentConfigurationIsInvalid();
IPSupport.throwSkippedExceptionIfNonOperational();
testBindNull();

View File

@ -56,7 +56,7 @@ public class HttpProxy {
static final int SO_TIMEOUT = 15000;
public static void main(String[] args) throws Exception {
IPSupport.skipIfCurrentConfigurationIsInvalid();
IPSupport.throwSkippedExceptionIfNonOperational();
String host;
int port;

View File

@ -47,7 +47,7 @@ public class InheritHandle
"bin" + File.separator + "java";
public static void main(String[] args) {
IPSupport.skipIfCurrentConfigurationIsInvalid();
IPSupport.throwSkippedExceptionIfNonOperational();
if (args.length == 1) {
doWait();

View File

@ -94,7 +94,7 @@ public class InheritTimeout {
}
public static void main(String args[]) throws Exception {
IPSupport.skipIfCurrentConfigurationIsInvalid();
IPSupport.throwSkippedExceptionIfNonOperational();
new InheritTimeout();
}
}

View File

@ -107,7 +107,7 @@ public class LingerTest {
}
public static void main(String args[]) throws Exception {
IPSupport.skipIfCurrentConfigurationIsInvalid();
IPSupport.throwSkippedExceptionIfNonOperational();
InetAddress loopback = InetAddress.getLoopbackAddress();
ServerSocket ss = new ServerSocket(0, 50, loopback);

View File

@ -122,7 +122,7 @@ public class LinkLocal {
}
public static void main(String args[]) throws Exception {
IPSupport.skipIfCurrentConfigurationIsInvalid();
IPSupport.throwSkippedExceptionIfNonOperational();
/*
* If an argument is provided ensure that it's

View File

@ -80,7 +80,7 @@ public class ProxyCons {
}
public static void main(String[] args) throws Exception {
IPSupport.skipIfCurrentConfigurationIsInvalid();
IPSupport.throwSkippedExceptionIfNonOperational();
ProxyCons c = new ProxyCons();
c.test();

View File

@ -80,7 +80,7 @@ public class RST implements Runnable {
public static void main(String args[]) throws Exception {
IPSupport.skipIfCurrentConfigurationIsInvalid();
IPSupport.throwSkippedExceptionIfNonOperational();
new RST();
}

View File

@ -36,7 +36,7 @@ import jdk.test.lib.net.IPSupport;
public class ReadTimeout {
public static void main(String args[]) throws Exception {
IPSupport.skipIfCurrentConfigurationIsInvalid();
IPSupport.throwSkippedExceptionIfNonOperational();
InetAddress sin = null;
Socket soc = null,soc1 = null;

View File

@ -39,7 +39,7 @@ import jdk.test.lib.net.IPSupport;
public class RejectIPv6 {
public static void main(String [] argv) throws Throwable {
IPSupport.skipIfCurrentConfigurationIsInvalid();
IPSupport.throwSkippedExceptionIfNonOperational();
ServerSocket serverSocket = new ServerSocket(0);
serverSocket.setSoTimeout(1000);

View File

@ -37,7 +37,7 @@ public class SetSoLinger {
static final int LINGER = 65546;
public static void main(String args[]) throws Exception {
IPSupport.skipIfCurrentConfigurationIsInvalid();
IPSupport.throwSkippedExceptionIfNonOperational();
int value;
InetAddress addr = InetAddress.getLocalHost();

View File

@ -45,7 +45,7 @@ public class ShutdownInput {
static boolean failed = false;
public static void main(String args[]) throws Exception {
IPSupport.skipIfCurrentConfigurationIsInvalid();
IPSupport.throwSkippedExceptionIfNonOperational();
InetAddress iaddr = InetAddress.getLocalHost();

View File

@ -50,7 +50,7 @@ public class SocksConnectTimeout {
static int failed, passed;
public static void main(String[] args) {
IPSupport.skipIfCurrentConfigurationIsInvalid();
IPSupport.throwSkippedExceptionIfNonOperational();
try {
serverSocket = new ServerSocket(0);

View File

@ -40,7 +40,7 @@ public class TestAfterClose
static int failCount;
public static void main(String[] args) {
IPSupport.skipIfCurrentConfigurationIsInvalid();
IPSupport.throwSkippedExceptionIfNonOperational();
try {
InetAddress loopback = InetAddress.getLoopbackAddress();

View File

@ -37,7 +37,7 @@ import jdk.test.lib.net.IPSupport;
public class TestClose {
public static void main(String[] args) throws Exception {
IPSupport.skipIfCurrentConfigurationIsInvalid();
IPSupport.throwSkippedExceptionIfNonOperational();
ServerSocket ss;
Socket s;

View File

@ -37,7 +37,7 @@ import jdk.test.lib.net.IPSupport;
public class TestTcpNoDelay
{
public static void main(String[] args) {
IPSupport.skipIfCurrentConfigurationIsInvalid();
IPSupport.throwSkippedExceptionIfNonOperational();
try {
Socket socket = new Socket();

View File

@ -35,7 +35,7 @@ import jdk.test.lib.net.IPSupport;
public class Timeout {
public static void main(String[] args) throws Exception {
IPSupport.skipIfCurrentConfigurationIsInvalid();
IPSupport.throwSkippedExceptionIfNonOperational();
boolean success = false;
ServerSocket sock = new ServerSocket(0);

View File

@ -63,7 +63,7 @@ public class TrafficClass {
}
public static void main(String args[]) throws Exception {
IPSupport.skipIfCurrentConfigurationIsInvalid();
IPSupport.throwSkippedExceptionIfNonOperational();
DatagramSocket ds = new DatagramSocket();
testDatagramSocket(ds);

View File

@ -53,7 +53,7 @@ public class UrgentDataTest {
}
public static void main (String args[]) {
IPSupport.skipIfCurrentConfigurationIsInvalid();
IPSupport.throwSkippedExceptionIfNonOperational();
try {
UrgentDataTest test = new UrgentDataTest ();

View File

@ -40,7 +40,7 @@ import static java.util.concurrent.CompletableFuture.*;
public class AsyncClose {
public static void main(String args[]) throws Exception {
IPSupport.skipIfCurrentConfigurationIsInvalid();
IPSupport.throwSkippedExceptionIfNonOperational();
AsyncCloseTest tests[] = {
new Socket_getInputStream_read(),

View File

@ -55,7 +55,7 @@ public class BrokenPipe {
}
public static void main(String[] args) throws Exception {
IPSupport.skipIfCurrentConfigurationIsInvalid();
IPSupport.throwSkippedExceptionIfNonOperational();
ServerSocket ss = new ServerSocket(0);
Socket client = new Socket(InetAddress.getLocalHost(),

View File

@ -228,7 +228,7 @@ public class Basic {
}
public static void main(String args[]) throws Exception {
IPSupport.skipIfCurrentConfigurationIsInvalid();
IPSupport.throwSkippedExceptionIfNonOperational();
new Basic();
}

View File

@ -49,7 +49,7 @@ public class Restart {
*/
public static void main(String args[]) throws Exception {
IPSupport.skipIfCurrentConfigurationIsInvalid();
IPSupport.throwSkippedExceptionIfNonOperational();
ServerSocket ss = new ServerSocket(0);
Socket s1 = null, s2 = null;

View File

@ -63,7 +63,7 @@ public class SocketClosedException {
static Exception serverException = null;
public static void main(String[] args) throws Exception {
IPSupport.skipIfCurrentConfigurationIsInvalid();
IPSupport.throwSkippedExceptionIfNonOperational();
serverSocket = new ServerSocket(0);
startServer();
try {

View File

@ -38,7 +38,7 @@ public class SocketTimeout {
static final int TIMEOUT = 1000;
public static void main(String args[]) throws Exception {
IPSupport.skipIfCurrentConfigurationIsInvalid();
IPSupport.throwSkippedExceptionIfNonOperational();
InetAddress sin = InetAddress.getLocalHost();
Socket soc = null,soc1 = null;
InputStream is = null;

View File

@ -44,7 +44,7 @@ public class ImmutableOptions {
@BeforeTest
void setupServerSocketFactory() throws IOException {
IPSupport.skipIfCurrentConfigurationIsInvalid();
IPSupport.throwSkippedExceptionIfNonOperational();
ServerSocket.setSocketFactory(new ServerSocketImplFactory());
}

View File

@ -36,7 +36,7 @@ import jdk.test.lib.net.IPSupport;
public class MinimumRcvBufferSize {
public static void main(String args[]) throws Exception {
IPSupport.skipIfCurrentConfigurationIsInvalid();
IPSupport.throwSkippedExceptionIfNonOperational();
boolean error = false;
ServerSocketChannel channel = ServerSocketChannel.open();

View File

@ -280,7 +280,7 @@ public class OptionsTest {
}
public static void main(String args[]) throws Exception {
IPSupport.skipIfCurrentConfigurationIsInvalid();
IPSupport.throwSkippedExceptionIfNonOperational();
doSocketTests();
doServerSocketTests();
doDgSocketTests();

View File

@ -44,7 +44,7 @@ import jdk.test.lib.net.IPSupport;
public class SupportedOptionsSet {
public static void main(String[] args) throws IOException {
IPSupport.skipIfCurrentConfigurationIsInvalid();
IPSupport.throwSkippedExceptionIfNonOperational();
if (args[0].equals("first"))
first();

View File

@ -72,7 +72,7 @@ public class UnsupportedOptionsTest {
}
public static void main(String[] args) throws IOException {
IPSupport.skipIfCurrentConfigurationIsInvalid();
IPSupport.throwSkippedExceptionIfNonOperational();
Socket s = new Socket();
ServerSocket ss = new ServerSocket();

View File

@ -38,7 +38,7 @@ import jdk.test.lib.net.IPSupport;
public class Disconnect {
public static void main(String[] args) throws IOException {
IPSupport.skipIfCurrentConfigurationIsInvalid();
IPSupport.throwSkippedExceptionIfNonOperational();
// test with default protocol family
try (DatagramChannel dc = DatagramChannel.open()) {

View File

@ -240,7 +240,7 @@ public class MulticastSendReceiveTests {
}
public static void main(String[] args) throws IOException {
IPSupport.skipIfCurrentConfigurationIsInvalid();
IPSupport.throwSkippedExceptionIfNonOperational();
NetworkConfiguration config = NetworkConfiguration.probe();

View File

@ -193,7 +193,7 @@ public class Promiscuous {
}
public static void main(String[] args) throws IOException {
IPSupport.skipIfCurrentConfigurationIsInvalid();
IPSupport.throwSkippedExceptionIfNonOperational();
String os = System.getProperty("os.name");

View File

@ -48,7 +48,7 @@ public class UseDGWithIPv6 {
public static void main(String[] args) throws IOException
{
IPSupport.skipIfCurrentConfigurationIsInvalid();
IPSupport.throwSkippedExceptionIfNonOperational();
ByteBuffer data = ByteBuffer.wrap("TESTING DATA".getBytes());
DatagramChannel dgChannel = DatagramChannel.open();

View File

@ -44,7 +44,7 @@ public class PrintSupportedOptions {
}
public static void main(String[] args) throws IOException {
IPSupport.skipIfCurrentConfigurationIsInvalid();
IPSupport.throwSkippedExceptionIfNonOperational();
test(() -> SocketChannel.open());
test(() -> ServerSocketChannel.open());

View File

@ -123,9 +123,19 @@ public class IPSupport {
}
/**
* Throws a jtreg.SkippedException if the current networking configuration is invalid.
* Ensures that the platform supports the ability to create a
* minimally-operational socket whose protocol is either one of IPv4
* or IPv6.
*
* <p> A minimally-operation socket is one that can be created and
* bound to an IP-specific loopback address. IP support is
* considered non-operational if a socket cannot be bound to either
* one of, an IPv4 loopback address, or the IPv6 loopback address.
*
* @throws SkippedException if the current networking configuration
* is non-operational
*/
public static void skipIfCurrentConfigurationIsInvalid() throws SkippedException {
public static void throwSkippedExceptionIfNonOperational() throws SkippedException {
if (!currentConfigurationIsValid()) {
ByteArrayOutputStream os = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(os);