Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
32.4k views
in Java FTP by
Hello there,

if I'm listing directories with a large amount of files (here about 2000 files) by using

FTPFile[] files = ftp_client.dirDetails(".")


I get an ArrayIndexOutOfBoundsException =(

With smaller directories, there is no problem.

Someone has a suggestion to solve this?

Thank you

David

38 Answers

0 votes
by
Hi there,

I've still got that problem:

 Here comes the directory listing.
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 16 Jun 2004 09:47:19.500 : 226
 Directory send OK.
java.lang.ArrayIndexOutOfBoundsException: 12
        at com.enterprisedt.net.ftp.FTPFileParser.split(FTPFileParser.java:89)
        at com.enterprisedt.net.ftp.UnixFileParser.parse(UnixFileParser.java:116
)
        at com.enterprisedt.net.ftp.FTPFileFactory.parse(FTPFileFactory.java:118
)
        at com.enterprisedt.net.ftp.FTPClient.dirDetails(FTPClient.java:1554)
0 votes
by (162k points)
What operating system and FTP server are you using?

Hi there,

I've still got that problem:
0 votes
by (162k points)
Ok, I think I see your problem. To test out a solution, can you try this?

Edit FTPFileParser.java, and change

private final static int MAX_FIELDS = 12;

to

private final static int MAX_FIELDS = 20;

Recompile and give it a go - this should sort your problem out (I hope!)


Hi there,

I've still got that problem:
0 votes
by (162k points)
This fix is in 1.4.1, out now.

We've tried with a file of the same name, works fine.

Ok, I think I see your problem. To test out a solution, can you try this?

Edit FTPFileParser.java, and change

private final static int MAX_FIELDS = 12;

to

private final static int MAX_FIELDS = 20;

Recompile and give it a go - this should sort your problem out (I hope!)


Hi there,

I've still got that problem:
0 votes
by (460 points)
Hi there

I am using version 1.4.3 and still am getting the IndexOutOfBoundsException and ParseException on dirDetails(). The server is a SunOS 5.8 with default FTP server. Any suggestions to try?

Thanks, Chris Schuit
________
Think Mill
0 votes
by (162k points)
Could you post a directory listing up here for us?

Hi there

I am using version 1.4.3 and still am getting the IndexOutOfBoundsException and ParseException on dirDetails(). The server is a SunOS 5.8 with default FTP server. Any suggestions to try?

Thanks, Chris Schuit
0 votes
by (460 points)
The directory structure on the Sun is:

-rw-rw-rw-   1 2960     100           26537 Sep  9 00:46 09064426507.req.copied
-rw-rw-rw-   2 2960     100          234092 Sep  9 01:07 09064426507.res
-rw-rw-rw-   2 2960     100          234092 Sep  9 01:07 09064426507.res.20040909
-rw-rw-rw-   1 2960     100           26632 Sep  9 00:46 09064428837.req.copied

*snip*

There are over 1600 files in the directory, total of 192M. Might that be an issue?

Thanks
________
Bubbler pipe
0 votes
by (162k points)
Can you post the stacktrace and if possible the actual line of the listing where it falls over? Thanks - should have asked for this earlier. The number of files shouldn't be an issue.

There are over 1600 files in the directory, total of 192M. Might that be an issue?

Thanks
0 votes
by (460 points)
The stack trace:
java.text.ParseException: Unexpected number of fields: 8
   at com.enterprisedt.net.ftp.UnixFileParser.parse(UnixFileParser.java:126)
   at com.enterprisedt.net.ftp.FTPFileFactory.parse(FTPFileFactory.java:159)
   at com.enterprisedt.net.ftp.FTPClient.dirDetails(FTPClient.java:1722)


I can't determine which line of the directory listing generates this error. If you have a way to test this, I'm all for it ;)
________
Attention deficit disorder (add) advice
0 votes
by (300 points)
with a debugger you could maybe know for which file it occurs. or simply add a writeline of the current processed string ?

or you could send a zip file with "ls > output" content and then the support will have to recreate the dir with a "touch script" for e.g ...

Categories

...