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:27:55 GMT

I've committed the implementation of readNextEntry() below and updated
the test to ensure the parser can handle entries with line breaks ( it
always could ).  Now we just need to test that the stream reading is
working.

>>>>> On Mon, 03 Mar 2003 09:18:20 -0600, jbrekke@wi.rr.com (Jeffrey D. Brekke)
said:

> 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.

-- 
=====================================================================
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