author | prr |
Fri, 25 May 2018 12:12:24 -0700 | |
changeset 50347 | b2f046ae8eb6 |
parent 47216 | 71c04702a3d5 |
child 54681 | edd709e64ea1 |
permissions | -rw-r--r-- |
39732
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
1 |
/* |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
2 |
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
4 |
* |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
8 |
* |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
13 |
* accompanied this code). |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
14 |
* |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
18 |
* |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
21 |
* questions. |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
22 |
*/ |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
23 |
|
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
24 |
/* |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
25 |
* @test |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
26 |
* @bug 8022580 |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
27 |
* @summary "null" should be treated as "current directory" in nameList() |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
28 |
* method of FtpClient |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
29 |
* @modules java.base/sun.net.ftp |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
30 |
* @run main TestFtpClientNameListWithNull |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
31 |
*/ |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
32 |
|
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
33 |
|
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
34 |
import sun.net.ftp.FtpClient; |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
35 |
|
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
36 |
import java.io.BufferedReader; |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
37 |
import java.io.IOException; |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
38 |
import java.io.InputStreamReader; |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
39 |
import java.io.PrintWriter; |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
40 |
import java.net.InetSocketAddress; |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
41 |
import java.net.ServerSocket; |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
42 |
import java.net.Socket; |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
43 |
import java.net.SocketException; |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
44 |
|
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
45 |
|
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
46 |
public class TestFtpClientNameListWithNull { |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
47 |
|
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
48 |
private static volatile boolean commandHasArgs; |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
49 |
|
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
50 |
public static void main(String[] args) throws Exception { |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
51 |
try (FtpServer server = new FtpServer(); |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
52 |
FtpClient client = FtpClient.create()) { |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
53 |
(new Thread(server)).start(); |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
54 |
int port = server.getPort(); |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
55 |
client.connect(new InetSocketAddress("localhost", port)); |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
56 |
client.nameList(null); |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
57 |
} finally { |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
58 |
if (commandHasArgs) { |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
59 |
throw new RuntimeException("Test failed. NLST shouldn't have " + |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
60 |
"args if nameList parameter is null"); |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
61 |
} |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
62 |
} |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
63 |
} |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
64 |
|
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
65 |
private static class FtpServer implements AutoCloseable, Runnable { |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
66 |
private final ServerSocket serverSocket; |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
67 |
|
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
68 |
FtpServer() throws IOException { |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
69 |
serverSocket = new ServerSocket(0); |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
70 |
} |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
71 |
|
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
72 |
public void handleClient(Socket client) throws IOException { |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
73 |
boolean done = false; |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
74 |
String str; |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
75 |
|
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
76 |
client.setSoTimeout(2000); |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
77 |
BufferedReader in = new BufferedReader(new InputStreamReader(client. |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
78 |
getInputStream())); |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
79 |
PrintWriter out = new PrintWriter(client.getOutputStream(), true); |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
80 |
out.println("220 FTP serverSocket is ready."); |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
81 |
while (!done) { |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
82 |
try { |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
83 |
str = in.readLine(); |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
84 |
} catch (SocketException e) { |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
85 |
done = true; |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
86 |
continue; |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
87 |
} |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
88 |
String cmd = str.substring(0, str.indexOf(" ") > 0 ? |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
89 |
str.indexOf(" ") : str.length()); |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
90 |
String args = (cmd.equals(str)) ? |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
91 |
"" : str.substring(str.indexOf(" ")); |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
92 |
switch (cmd) { |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
93 |
case "QUIT": |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
94 |
out.println("221 Goodbye."); |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
95 |
out.flush(); |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
96 |
done = true; |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
97 |
break; |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
98 |
case "EPSV": |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
99 |
if ("all".equalsIgnoreCase(args)) { |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
100 |
out.println("200 EPSV ALL command successful."); |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
101 |
continue; |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
102 |
} |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
103 |
out.println("229 Entering Extended Passive Mode " + |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
104 |
"(|||" + getPort() + "|)"); |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
105 |
break; |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
106 |
case "NLST": |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
107 |
if (args.trim().length() != 0) { |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
108 |
commandHasArgs = true; |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
109 |
} |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
110 |
out.println("200 Command okay."); |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
111 |
break; |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
112 |
default: |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
113 |
out.println("500 unsupported command: " + str); |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
114 |
} |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
115 |
} |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
116 |
} |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
117 |
|
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
118 |
public int getPort() { |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
119 |
if (serverSocket != null) { |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
120 |
return serverSocket.getLocalPort(); |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
121 |
} |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
122 |
return 0; |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
123 |
} |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
124 |
|
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
125 |
public void close() throws IOException { |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
126 |
if (serverSocket != null && !serverSocket.isClosed()) { |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
127 |
serverSocket.close(); |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
128 |
} |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
129 |
} |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
130 |
|
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
131 |
@Override |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
132 |
public void run() { |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
133 |
try { |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
134 |
try (Socket client = serverSocket.accept()) { |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
135 |
handleClient(client); |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
136 |
} |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
137 |
} catch (IOException e) { |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
138 |
throw new RuntimeException("Problem in test execution", e); |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
139 |
} |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
140 |
} |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
141 |
} |
8db47f51465e
8022580: sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly
snikandrova
parents:
diff
changeset
|
142 |
} |