Skip to content

Commit b86d850

Browse files
committed
8361423: Add IPSupport::printPlatformSupport to java/net/NetworkInterface/IPv4Only.java
Backport-of: 2f1aed2a165259a873636792cff7c9de4e1f334e
1 parent c0647b0 commit b86d850

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

test/jdk/java/net/NetworkInterface/IPv4Only.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2010, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -29,12 +29,18 @@
2929
*/
3030

3131

32-
import java.net.*;
33-
import java.util.*;
32+
3433
import jdk.test.lib.net.IPSupport;
3534

35+
import java.net.Inet6Address;
36+
import java.net.InetAddress;
37+
import java.net.NetworkInterface;
38+
import java.net.SocketException;
39+
import java.util.Enumeration;
40+
3641
public class IPv4Only {
3742
public static void main(String[] args) throws Exception {
43+
IPSupport.printPlatformSupport(System.out);
3844
if (IPSupport.hasIPv4()) {
3945
System.out.println("Testing IPv4");
4046
Enumeration<NetworkInterface> nifs = NetworkInterface.getNetworkInterfaces();
@@ -43,7 +49,7 @@ public static void main(String[] args) throws Exception {
4349
Enumeration<InetAddress> addrs = nif.getInetAddresses();
4450
while (addrs.hasMoreElements()) {
4551
InetAddress hostAddr = addrs.nextElement();
46-
if ( hostAddr instanceof Inet6Address ){
52+
if (hostAddr instanceof Inet6Address){
4753
throw new RuntimeException( "NetworkInterfaceV6List failed - found v6 address " + hostAddr.getHostAddress() );
4854
}
4955
}

0 commit comments

Comments
 (0)