Sorry, I didn't read your previous mail sooner. I too had to make this
change.
-----Original Message-----
From: owner-openmap-users@bbn.com [mailto:owner-openmap-users@bbn.com]
On Behalf Of Gubler, Rüdiger
Sent: Wednesday, October 09, 2002 4:47 AM
To: Openmap-Users (E-Mail); Don Dietrick (E-Mail)
Subject: AW: Error in DbfInputStream ?!
Hello,
i changed ind the readData() method in DbfInputStream the part
if(type == DbfTableModel.TYPE_NUMERIC)
{
String cell = _leis.readString(length);
record.add(c, new Double(cell));
}
else
{
String cell = _leis.readString(length);
record.add(c, cell);
}
to
String cell = _leis.readString(length);
if(type == DbfTableModel.TYPE_NUMERIC && !cell.equals( "" ) )
{ ^^^^^^^^^^^^^^^^^^^^^
record.add(c, new Double(cell));
}
else
{
record.add(c, cell);
}
Now it works. Could you fix this in the next release?
Yours Ruediger
> -----Ursprüngliche Nachricht-----
> Von: Gubler, Rüdiger
> Gesendet: Dienstag, 8. Oktober 2002 12:28
> An: Openmap-Users (E-Mail); Don Dietrick (E-Mail)
> Betreff: Error in DbfInputStream ?!
>
>
>
> Hello,
>
> while opening the attached file i get the following exception:
>
> java.lang.NumberFormatException: empty String
> at
> java.lang.FloatingDecimal.readJavaFormatString(FloatingDecimal
> .java:989)
> at java.lang.Double.valueOf(Double.java:168)
> at java.lang.Double.<init>(Double.java:240)
> at
> com.bbn.openmap.dataAccess.shape.input.DbfInputStream.readData
> (Unknown Source)
> at
> com.bbn.openmap.dataAccess.shape.input.DbfInputStream.<init>(U
> nknown Source)
> at test.MainTest.main(MainTest.java:23)
>
>
>
> My code:
>
>
> import java.io.FileInputStream;
> import java.util.Iterator;
> import java.util.List;
>
> import com.bbn.openmap.dataAccess.shape.input.DbfInputStream;
>
> public class MainTest
> {
>
> public static void main(String[] args)
> {
> FileInputStream fis;
> DbfInputStream dbfIS;
> List dataList, dataRow;
> Iterator it, it2;
> String[] columnNames;
>
> try
> {
> fis = new FileInputStream( "C:/test.dbf" );
> dbfIS = new DbfInputStream( fis );
>
> dataList = dbfIS.getRecords();
>
> columnNames = dbfIS.getColumnNames();
>
> for( int ii = 0; ii < columnNames.length; ii++ )
> {
> System.err.print( columnNames[ii] + (ii <
> columnNames.length - 1 ? ", " : "\n") );
> }
>
> it = dataList.iterator();
> while( it.hasNext() )
> {
> dataRow = (List)it.next();
>
> it2 = dataRow.iterator();
> while( it2.hasNext() )
> {
> System.err.print( it2.next() + (it2.hasNext() ? ",
> " : "\n") );
> }
>
> }
>
> }
> catch( Exception ex )
> {
> ex.printStackTrace();
> }
>
> }
>
> }
>
>
>
>
>
> Yours Ruediger
>
>
>
-- [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"] -- [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 Wed Oct 9 09:02:35 2002
This archive was generated by hypermail 2.1.8 : Thu May 12 2005 - 07:18:33 EDT