File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
test/jdk/java/net/NetworkInterface Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change 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
2929 */
3030
3131
32- import java .net .*;
33- import java .util .*;
32+
3433import 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+
3641public 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 }
You can’t perform that action at this time.
0 commit comments