commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steve Cohen" <>
Subject RE: [NET] ftp entry spans lines
Date Mon, 03 Mar 2003 15:30:37 GMT
It looks like the algorithm that vms uses is if the file name is longer
than the space alloted to it, they continue onto a new line.  I wonder
if any other systems also do this.

I think I should create a separate test for the filelist handling.  One
test tests the parser, the other tests the list mechanism.  I'll just
put a bunch of listings into a file and read that in via a stream.  

Could you resend me this listing in a file?  I want to be sure that the
line feeds are in the original input and are not put there by the

-----Original Message-----
From: Jeffrey D. Brekke [] 
Sent: Monday, March 03, 2003 9:18 AM
To: Jakarta Commons Developers List
Subject: Re: [NET] ftp entry spans lines

OK, here's a live sample from a production VMS system.  We can add these
entries to the test case:
                         4/15         24-FEB-2003 13:17:24
UNARCHIVE.COM;1          2/15          7-JUL-1997 16:37:45
UNXMERGE.COM;15          1/15         20-AUG-1996 13:59:50
UNXTEMP.COM;7            1/15         15-AUG-1996 14:10:38
                        14/15         24-JUL-2002 14:35:40
                        14/15         17-JAN-2002 11:13:53

Your implementation of readNextEntry() would work with a slight

public String readNextEntry(BufferedReader reader) throws IOException {
    String line = reader.readLine();
    StringBuffer entry = new StringBuffer();
    while (line != null)
        if (line.trim().endsWith(")"))
        line = reader.readLine();
    return (entry.length()==0  ? null : entry.toString());
Now, we'd need to update the tests.  They work on the assumption there
is an array of strings to parse, we should probably go ahead and use an
FTPFileList and let it parse a sample stream instead iterating through
an array of strings:
FTPFileList flist = FTPFileList.create(in, getParser());
int i = 0;        
for (FTPFileIterator it = flist.iterator();it.hasNext();)
    FTPFile f =;

or something like that.  I can change the test for the VMS parser to
make sure that it can parse a line with a \r\n in side it, but we still
should test the above FTPFileList stuff.


>>>>> On Sat, 1 Mar 2003 21:43:42 -0600, "Steve Cohen" 
>>>>> <> said:

> I guess that can work.  Perhaps the "simple" regex for could merely 
> look for an expression in parentheses to delimit entries, assuming 
> that every entry really does end that way.  Even the closing 
> parenthesis might be enough to key off.  But we'd need to find some 
> real-world sites or a good spec for the OpenVMS FTP to know for sure.

> There are many ways to skin this cat.  Even in the worst case, the VMS

> parser could override all the methods and do its own thing.  For that 
> matter, there isn't even anything that FORCES each parser to use 
> regular expressions.  But I don't think it will come to that.

Jeffrey D. Brekke                         
Wisconsin,  USA                           

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message