blob: 0fe573c0ea336ebaf2864e4d89567d29f7e07ad3 [file] [log] [blame]
J. Duke319a3b92007-12-01 00:00:00 +00001/* @test
2 * @bug 5042453
3 * @summary Ipv6 address throws Non-numeric port number error
4 */
5
6import com.sun.jndi.cosnaming.*;
7import com.sun.jndi.cosnaming.IiopUrl.Address;
8import java.util.*;
9import java.net.MalformedURLException;
10
11public class IiopUrlIPv6 {
12
13 public static void main(String[] args) {
14
15 String[] urls = {"iiop://[::1]:2809",
16 "iiop://[::1]",
17 "iiop://:2890",
18 "iiop://129.158.2.2:80"
19 };
20
21 for (int u = 0; u < urls.length; u++) {
22 try {
23 IiopUrl url = new IiopUrl(urls[u]);
24 Vector addrs = url.getAddresses();
25
26 for (int i = 0; i < addrs.size(); i++) {
27 Address addr = (Address)addrs.elementAt(i);
28 System.out.println("================");
29 System.out.println("url: " + urls[u]);
30 System.out.println("host: " + addr.host);
31 System.out.println("port: " + addr.port);
32 System.out.println("version: " + addr.major
33 + " " + addr.minor);
34 }
35 } catch (MalformedURLException e) {
36 e.printStackTrace();
37 }
38 }
39 }
40}