commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbre...@wi.rr.com (Jeffrey D. Brekke)
Subject Re: [NET] ftp entry spans lines
Date Mon, 03 Mar 2003 15:18:20 GMT

OK, here's a live sample from a production VMS system.  We can add these entries to the test
case:
       
UCX$REXECD_STARTUP.LOG;1098
                         4/15         24-FEB-2003 13:17:24  [POSTWARE,LP]    (RWED,RWED,RE,)
UNARCHIVE.COM;1          2/15          7-JUL-1997 16:37:45  [POSTWARE,LP]    (RWE,RWE,RWE,RE)
UNXMERGE.COM;15          1/15         20-AUG-1996 13:59:50  [POSTWARE,LP]    (RWE,RWE,RWE,RE)
UNXTEMP.COM;7            1/15         15-AUG-1996 14:10:38  [POSTWARE,LP]    (RWE,RWE,RWE,RE)
UNZIP_AND_ATTACH_FILES.COM;12
                        14/15         24-JUL-2002 14:35:40  [POSTWARE,LP]    (RWE,RWE,RWE,RE)
UNZIP_AND_ATTACH_FILES.SAV;1
                        14/15         17-JAN-2002 11:13:53  [POSTWARE,LP]    (RWE,RWED,RWE,RE)

Your implementation of readNextEntry() would work with a slight adjustment:

public String readNextEntry(BufferedReader reader) throws IOException
{
    String line = reader.readLine();
    StringBuffer entry = new StringBuffer();
    while (line != null)
    {
        entry.append(line);
        if (line.trim().endsWith(")"))
        {
            break;
        }    
        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 = it.next();
    assertNotNull(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.

jb

>>>>> On Sat, 1 Mar 2003 21:43:42 -0600, "Steve Cohen" <SCohen@sportvision.com>
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                                   jbrekke@wi.rr.com
Wisconsin,  USA                                     brekke@apache.org
                                                    ekkerbj@yahoo.com


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message