author | chegar |
Fri, 05 Jan 2018 14:11:48 +0000 | |
branch | http-client-branch |
changeset 56008 | bbd688c6fbbb |
parent 47216 | 71c04702a3d5 |
permissions | -rw-r--r-- |
1629
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
1 |
/* |
22277
1d3a2cb3552f
8031651: Remove unneeded -source and -target flags in jdk repo regression tests
darcy
parents:
5506
diff
changeset
|
2 |
* Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved. |
1629
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
4 |
* |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
8 |
* |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
13 |
* accompanied this code). |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
14 |
* |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
18 |
* |
5506 | 19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
20 |
* or visit www.oracle.com if you need additional information or have any |
|
21 |
* questions. |
|
1629
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
22 |
*/ |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
23 |
|
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
24 |
/** |
44423 | 25 |
* @test LocalRMIServerSocketFactoryTest.java |
26 |
* @bug 6774170 |
|
27 |
* @summary Connect to a server socket returned by the LocalRMIServerSocketFactory. |
|
1629
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
28 |
* |
44423 | 29 |
* @author Daniel Fuchs |
1629
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
30 |
* |
44423 | 31 |
* @run compile -XDignore.symbol.file=true -g LocalRMIServerSocketFactoryTest.java |
32 |
* @run main LocalRMIServerSocketFactoryTest |
|
1629
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
33 |
*/ |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
34 |
|
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
35 |
import sun.management.jmxremote.LocalRMIServerSocketFactory; |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
36 |
import java.io.IOException; |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
37 |
import java.net.InetAddress; |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
38 |
import java.net.NetworkInterface; |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
39 |
import java.net.ServerSocket; |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
40 |
import java.net.Socket; |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
41 |
import java.util.concurrent.SynchronousQueue; |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
42 |
|
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
43 |
public class LocalRMIServerSocketFactoryTest { |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
44 |
|
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
45 |
private static final SynchronousQueue<Exception> queue = |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
46 |
new SynchronousQueue<Exception>(); |
22296
be5ab806f457
8004183: test/sun/management/jmxremote/LocalRMIServerSocketFactoryTest.java doesn't clean-up
allwin
parents:
22277
diff
changeset
|
47 |
private static volatile boolean isRunning = true; |
1629
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
48 |
|
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
49 |
static final class Result extends Exception { |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
50 |
|
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
51 |
private Result() { |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
52 |
super("SUCCESS: No exception was thrown"); |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
53 |
} |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
54 |
static final Result SUCCESS = new Result(); |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
55 |
} |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
56 |
|
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
57 |
private static void checkError(String message) throws Exception { |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
58 |
|
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
59 |
// Wait for the server to set the error field. |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
60 |
final Exception x = queue.take(); |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
61 |
|
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
62 |
if (x == Result.SUCCESS) { |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
63 |
return; |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
64 |
} |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
65 |
|
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
66 |
|
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
67 |
// case of 6674166: this is very unlikely to happen, even if |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
68 |
// both 6674166 and 6774170 aren't fixed. If it happens |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
69 |
// however, it might indicate that neither defects are fixed. |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
70 |
|
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
71 |
if (x instanceof NullPointerException) { |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
72 |
throw new Exception(message + " - " + |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
73 |
"Congratulations! it seems you have triggered 6674166. " + |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
74 |
"Neither 6674166 nor 6774170 seem to be fixed: " + x, x); |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
75 |
} else if (x instanceof IOException) { |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
76 |
throw new Exception(message + " - " + |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
77 |
"Unexpected IOException. Maybe you triggered 6674166? " + |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
78 |
x, x); |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
79 |
} else if (x != null) { |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
80 |
throw new Exception(message + " - " + |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
81 |
"Ouch, that's bad. " + |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
82 |
"This is a new kind of unexpected exception " + |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
83 |
x, x); |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
84 |
} |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
85 |
} |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
86 |
|
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
87 |
public static void main(String[] args) throws Exception { |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
88 |
final LocalRMIServerSocketFactory f = |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
89 |
new LocalRMIServerSocketFactory(); |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
90 |
final ServerSocket s = f.createServerSocket(0); |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
91 |
final int port = s.getLocalPort(); |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
92 |
Thread t = new Thread() { |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
93 |
|
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
94 |
public void run() { |
22296
be5ab806f457
8004183: test/sun/management/jmxremote/LocalRMIServerSocketFactoryTest.java doesn't clean-up
allwin
parents:
22277
diff
changeset
|
95 |
while (isRunning) { |
1629
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
96 |
Exception error = Result.SUCCESS; |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
97 |
try { |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
98 |
System.err.println("Accepting: "); |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
99 |
final Socket ss = s.accept(); |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
100 |
System.err.println(ss.getInetAddress() + " accepted"); |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
101 |
} catch (Exception x) { |
22296
be5ab806f457
8004183: test/sun/management/jmxremote/LocalRMIServerSocketFactoryTest.java doesn't clean-up
allwin
parents:
22277
diff
changeset
|
102 |
if (isRunning) { |
be5ab806f457
8004183: test/sun/management/jmxremote/LocalRMIServerSocketFactoryTest.java doesn't clean-up
allwin
parents:
22277
diff
changeset
|
103 |
x.printStackTrace(); |
be5ab806f457
8004183: test/sun/management/jmxremote/LocalRMIServerSocketFactoryTest.java doesn't clean-up
allwin
parents:
22277
diff
changeset
|
104 |
} |
1629
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
105 |
error = x; |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
106 |
} finally { |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
107 |
try { |
22296
be5ab806f457
8004183: test/sun/management/jmxremote/LocalRMIServerSocketFactoryTest.java doesn't clean-up
allwin
parents:
22277
diff
changeset
|
108 |
if (isRunning) { |
be5ab806f457
8004183: test/sun/management/jmxremote/LocalRMIServerSocketFactoryTest.java doesn't clean-up
allwin
parents:
22277
diff
changeset
|
109 |
// wait for the client to get the exception. |
be5ab806f457
8004183: test/sun/management/jmxremote/LocalRMIServerSocketFactoryTest.java doesn't clean-up
allwin
parents:
22277
diff
changeset
|
110 |
queue.put(error); |
be5ab806f457
8004183: test/sun/management/jmxremote/LocalRMIServerSocketFactoryTest.java doesn't clean-up
allwin
parents:
22277
diff
changeset
|
111 |
} |
1629
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
112 |
} catch (Exception x) { |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
113 |
// too bad! |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
114 |
System.err.println("Could't send result to client!"); |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
115 |
x.printStackTrace(); |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
116 |
return; |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
117 |
} |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
118 |
} |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
119 |
} |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
120 |
} |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
121 |
}; |
22296
be5ab806f457
8004183: test/sun/management/jmxremote/LocalRMIServerSocketFactoryTest.java doesn't clean-up
allwin
parents:
22277
diff
changeset
|
122 |
|
be5ab806f457
8004183: test/sun/management/jmxremote/LocalRMIServerSocketFactoryTest.java doesn't clean-up
allwin
parents:
22277
diff
changeset
|
123 |
try { |
be5ab806f457
8004183: test/sun/management/jmxremote/LocalRMIServerSocketFactoryTest.java doesn't clean-up
allwin
parents:
22277
diff
changeset
|
124 |
t.start(); |
1629
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
125 |
|
22296
be5ab806f457
8004183: test/sun/management/jmxremote/LocalRMIServerSocketFactoryTest.java doesn't clean-up
allwin
parents:
22277
diff
changeset
|
126 |
System.err.println("new Socket((String)null, port)"); |
be5ab806f457
8004183: test/sun/management/jmxremote/LocalRMIServerSocketFactoryTest.java doesn't clean-up
allwin
parents:
22277
diff
changeset
|
127 |
final Socket s1 = new Socket((String) null, port); |
be5ab806f457
8004183: test/sun/management/jmxremote/LocalRMIServerSocketFactoryTest.java doesn't clean-up
allwin
parents:
22277
diff
changeset
|
128 |
checkError("new Socket((String)null, port)"); |
be5ab806f457
8004183: test/sun/management/jmxremote/LocalRMIServerSocketFactoryTest.java doesn't clean-up
allwin
parents:
22277
diff
changeset
|
129 |
s1.close(); |
be5ab806f457
8004183: test/sun/management/jmxremote/LocalRMIServerSocketFactoryTest.java doesn't clean-up
allwin
parents:
22277
diff
changeset
|
130 |
System.err.println("new Socket((String)null, port): PASSED"); |
be5ab806f457
8004183: test/sun/management/jmxremote/LocalRMIServerSocketFactoryTest.java doesn't clean-up
allwin
parents:
22277
diff
changeset
|
131 |
|
be5ab806f457
8004183: test/sun/management/jmxremote/LocalRMIServerSocketFactoryTest.java doesn't clean-up
allwin
parents:
22277
diff
changeset
|
132 |
System.err.println("new Socket(InetAddress.getByName(null), port)"); |
be5ab806f457
8004183: test/sun/management/jmxremote/LocalRMIServerSocketFactoryTest.java doesn't clean-up
allwin
parents:
22277
diff
changeset
|
133 |
final Socket s2 = new Socket(InetAddress.getByName(null), port); |
be5ab806f457
8004183: test/sun/management/jmxremote/LocalRMIServerSocketFactoryTest.java doesn't clean-up
allwin
parents:
22277
diff
changeset
|
134 |
checkError("new Socket(InetAddress.getByName(null), port)"); |
be5ab806f457
8004183: test/sun/management/jmxremote/LocalRMIServerSocketFactoryTest.java doesn't clean-up
allwin
parents:
22277
diff
changeset
|
135 |
s2.close(); |
be5ab806f457
8004183: test/sun/management/jmxremote/LocalRMIServerSocketFactoryTest.java doesn't clean-up
allwin
parents:
22277
diff
changeset
|
136 |
System.err.println("new Socket(InetAddress.getByName(null), port): PASSED"); |
1629
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
137 |
|
22296
be5ab806f457
8004183: test/sun/management/jmxremote/LocalRMIServerSocketFactoryTest.java doesn't clean-up
allwin
parents:
22277
diff
changeset
|
138 |
System.err.println("new Socket(localhost, port)"); |
be5ab806f457
8004183: test/sun/management/jmxremote/LocalRMIServerSocketFactoryTest.java doesn't clean-up
allwin
parents:
22277
diff
changeset
|
139 |
final Socket s3 = new Socket("localhost", port); |
be5ab806f457
8004183: test/sun/management/jmxremote/LocalRMIServerSocketFactoryTest.java doesn't clean-up
allwin
parents:
22277
diff
changeset
|
140 |
checkError("new Socket(localhost, port)"); |
be5ab806f457
8004183: test/sun/management/jmxremote/LocalRMIServerSocketFactoryTest.java doesn't clean-up
allwin
parents:
22277
diff
changeset
|
141 |
s3.close(); |
be5ab806f457
8004183: test/sun/management/jmxremote/LocalRMIServerSocketFactoryTest.java doesn't clean-up
allwin
parents:
22277
diff
changeset
|
142 |
System.err.println("new Socket(localhost, port): PASSED"); |
1629
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
143 |
|
22296
be5ab806f457
8004183: test/sun/management/jmxremote/LocalRMIServerSocketFactoryTest.java doesn't clean-up
allwin
parents:
22277
diff
changeset
|
144 |
System.err.println("new Socket(127.0.0.1, port)"); |
be5ab806f457
8004183: test/sun/management/jmxremote/LocalRMIServerSocketFactoryTest.java doesn't clean-up
allwin
parents:
22277
diff
changeset
|
145 |
final Socket s4 = new Socket("127.0.0.1", port); |
be5ab806f457
8004183: test/sun/management/jmxremote/LocalRMIServerSocketFactoryTest.java doesn't clean-up
allwin
parents:
22277
diff
changeset
|
146 |
checkError("new Socket(127.0.0.1, port)"); |
be5ab806f457
8004183: test/sun/management/jmxremote/LocalRMIServerSocketFactoryTest.java doesn't clean-up
allwin
parents:
22277
diff
changeset
|
147 |
s4.close(); |
be5ab806f457
8004183: test/sun/management/jmxremote/LocalRMIServerSocketFactoryTest.java doesn't clean-up
allwin
parents:
22277
diff
changeset
|
148 |
System.err.println("new Socket(127.0.0.1, port): PASSED"); |
be5ab806f457
8004183: test/sun/management/jmxremote/LocalRMIServerSocketFactoryTest.java doesn't clean-up
allwin
parents:
22277
diff
changeset
|
149 |
} |
be5ab806f457
8004183: test/sun/management/jmxremote/LocalRMIServerSocketFactoryTest.java doesn't clean-up
allwin
parents:
22277
diff
changeset
|
150 |
finally { |
be5ab806f457
8004183: test/sun/management/jmxremote/LocalRMIServerSocketFactoryTest.java doesn't clean-up
allwin
parents:
22277
diff
changeset
|
151 |
isRunning = false; |
be5ab806f457
8004183: test/sun/management/jmxremote/LocalRMIServerSocketFactoryTest.java doesn't clean-up
allwin
parents:
22277
diff
changeset
|
152 |
s.close(); |
be5ab806f457
8004183: test/sun/management/jmxremote/LocalRMIServerSocketFactoryTest.java doesn't clean-up
allwin
parents:
22277
diff
changeset
|
153 |
t.join(); |
be5ab806f457
8004183: test/sun/management/jmxremote/LocalRMIServerSocketFactoryTest.java doesn't clean-up
allwin
parents:
22277
diff
changeset
|
154 |
} |
1629
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
155 |
} |
9d0fa22f9ffe
6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff
changeset
|
156 |
} |