[OpenMap Users] Bug reading CSV files

From: Sivak Ruslan V Civ AFRL/IFEB <Ruslan.Sivak@rl.af.mil>
Date: Fri Aug 01 2003 - 15:17:27 EDT

There is a bug in com.bbn.openmap.io.CSVFile where if the csv file doesn't
have the last element in the line, then that vector will have one less
element then the header, as the newline makes it get out of the while
loop...

This piece of code is the problem...

                 int count = 0;
            token = csvt.token();
            while (!csvt.isEOF(token)) {
                count++;
                Vector rec_line = new Vector();
                while (!csvt.isNewline(token)) {
                    rec_line.addElement(token);
                    token = csvt.token();
                    if (csvt.isEOF(token)) break;
                }

So if you feed it a file like this

LENGTH,TYPE,ADMN_CLASS,TOLL_RD,RTE_NUM1,RTE_NUM2,ROUTE
4.337,Multi-Lane Divided,Interstate,N, 80,,Interstate 80
0.216,Multi-Lane Divided,Interstate,Y,,,
0.437,Multi-Lane Divided,Interstate,N,287,,Interstate 287

Then the 2nd vector will have 1 less elements then the others (as there is a
\n right after the , on that line.

--
[To unsubscribe to this list send an email to "majdart@bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Fri Aug 1 15:19:54 2003

This archive was generated by hypermail 2.1.8 : Thu May 12 2005 - 07:18:36 EDT