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 { 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. // Create and close a DatagramSocket to warm up the FD count for side effects.
try (DatagramSocket s = new DatagramSocket(0)) { try (DatagramSocket s = new DatagramSocket(0)) {

View File

@ -34,7 +34,7 @@ import jdk.test.lib.net.IPSupport;
public class MinimumPermissions { public class MinimumPermissions {
public static void main(String[] args) { 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")) { if (System.getProperty("os.name").startsWith("Windows")) {
return; return;
} }
IPSupport.skipIfCurrentConfigurationIsInvalid(); IPSupport.throwSkippedExceptionIfNonOperational();
List<String> addrs = new ArrayList<String>(); List<String> addrs = new ArrayList<String>();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -122,7 +122,7 @@ public class LinkLocal {
} }
public static void main(String args[]) throws Exception { public static void main(String args[]) throws Exception {
IPSupport.skipIfCurrentConfigurationIsInvalid(); IPSupport.throwSkippedExceptionIfNonOperational();
/* /*
* If an argument is provided ensure that it's * 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 { public static void main(String[] args) throws Exception {
IPSupport.skipIfCurrentConfigurationIsInvalid(); IPSupport.throwSkippedExceptionIfNonOperational();
ProxyCons c = new ProxyCons(); ProxyCons c = new ProxyCons();
c.test(); c.test();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -44,7 +44,7 @@ public class PrintSupportedOptions {
} }
public static void main(String[] args) throws IOException { public static void main(String[] args) throws IOException {
IPSupport.skipIfCurrentConfigurationIsInvalid(); IPSupport.throwSkippedExceptionIfNonOperational();
test(() -> SocketChannel.open()); test(() -> SocketChannel.open());
test(() -> ServerSocketChannel.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()) { if (!currentConfigurationIsValid()) {
ByteArrayOutputStream os = new ByteArrayOutputStream(); ByteArrayOutputStream os = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(os); PrintStream ps = new PrintStream(os);