ftpclient listfiles为空解析(Ftpclient listfiles is empty parsing)
ftpclient listfiles为空解析(Ftpclient listfiles is empty parsing)
In the package FTPClient. ListFiles () method returns null problem and its solution < /wodong/archive/2008/08/21/wodong.html >
The project currently being developed requires downloading data from the remote server and using the open source .ftp package. A problem is found in the actual application, and the ftpclient.listfiles () method can be called on the test server to return an array containing the filename, and this method returns NULL on the current network server. I have been baffled by this question for a long time, and here are my thoughts on the following:
(1) firstly, the difference between the two servers is found: the test server is solaris server, and the current network server is the HP server. Can it be caused by the platform difference? With this problem, download the source code for the common package and debug it through source code.
(2) FTPListParseEngine handles the processing of information from a socket to obtain a remote server. I've probably done ls minus l
Manipulate, and put the results in a linkedlist. The code is as follows:
1private void readStream (InputStream stream, String encoding) throws IOException
2 {
3 BufferedReader reader;
4 if (encoding = = null)
5 {
6 reader = new BufferedReader (stream)
7}
8 the else
9 {
10 reader = new BufferedReader (stream, encoding);
11}
12
13 the String line = this. Parser. ReadNextEntry (reader);
14
15 while (line! = null)
16 {
17 this. Entries. The add (line);
18 the line = this. Parser. ReadNextEntry (reader);
19}
20 reader. The close ();
21}
22
(3) at this time, the problem is found, and the string in the line is in chaos! Normal should be:
Drwxr-xr-x 11 daladmin daladmin 1024 September 18, 2004 MQM
Time is a mess.
(4) : in the call listFiles () before calling ftpClient. SetControlEncoding (" GBK "); This line will display normally, but the listFiles () return is still empty!!! Continue to...
(5) it is found that a regular expression mat