From: <no...@so...> - 2002-01-23 10:56:36
|
Bugs item #505061, was opened at 2002-01-17 12:29 You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=104091&aid=505061&group_id=4091 Category: IO Group: Crash / Fatal Status: Open Resolution: Duplicate Priority: 5 Submitted By: Philip Crotwell (crotwell) Assigned to: Ian Turton (ianturton) Summary: ArrayIndexOutOfBounds Dbf.GrabNextDbfRec Initial Comment: I get an out of bounds exception with example1. This is with a cvs checkout on Jan 17 under java1.4. I turned on debug in ShapefileReader in the hopes that that would help. I tried changing byte[] strbuf = new byte[DBF_NAMELEN]; to byte[] strbuf = new byte[rec_size]; in Dbf.java (about line 230) and it seemed to work. [crotwell@heffalump demonstrations]$ appletviewer Example1.html ---->uk.ac.leeds.ccg.geotools.ShapefileReader constructed. Will identify itself as SfR-> SfR->Sub SfR->Looking for .zip version of /home/crotwell/ GeoTools/geotools/src/demonstraions/maps/ statepop SfR->No Ext /home/crotwell/GeoTools/geotools/ src/demonstrations/maps/statepop SfR->No Ext /home/crotwell/GeoTools/geotools/ src/demonstrations/maps/statepop SfR->zip url = file:/home/crotwell/GeoTools/ geotools/src/demonstrations/maps/sttepop.zip SfR->Opening zis SfR->Looking for entries SfR->Found entry dm_state_pop.dbf SfR->Entry: dm_state_pop.dbf SfR->Getting entry SfR->Found .dbf in zip file SfR->General exception in zip read java.lang.ArrayIndexOutOfBoundsException java.lang.ArrayIndexOutOfBoundsException at uk.ac.leeds.ccg.dbffile.Dbf.GrabNextDbfRec(Unkn own Source) at uk.ac.leeds.ccg.dbffile.Dbf.GrabFile(Unknown Source) at uk.ac.leeds.ccg.dbffile.Dbf.init(Unknown Source) at uk.ac.leeds.ccg.dbffile.Dbf.<init>(Unknown Source) at uk.ac.leeds.ccg.geotools.ShapefileReader$Loade r.run(Unknown Source) at uk.ac.leeds.ccg.geotools.ShapefileReader.< init>(Unknown Source) at uk.ac.leeds.ccg.geotools.ShapefileReader.< init>(Unknown Source) at Example1.loadMaps(Unknown Source) at Example1.start(Unknown Source) at sun.applet.AppletPanel.run(AppletPanel.java:358) at java.lang.Thread.run(Thread.java:539) SfR->Looking for files outside of zip file SfR->java.io.IOException: Sf-->File feched from URL file:/home/crotwell/GeoTool/geotools/src/ demonstrations/maps/statepop.shp was of zero length or could not e found java.lang.NullPointerException at uk.ac.leeds.ccg.geotools.ShapefileReader.guessI dCol(Unknown Source) at uk.ac.leeds.ccg.geotools.ShapefileReader.access $600(Unknown Source) at uk.ac.leeds.ccg.geotools.ShapefileReader$Loade r.populate(Unknown Souce) at uk.ac.leeds.ccg.geotools.ShapefileReader$Loade r.run(Unknown Source) at uk.ac.leeds.ccg.geotools.ShapefileReader.< init>(Unknown Source) at uk.ac.leeds.ccg.geotools.ShapefileReader.< init>(Unknown Source) at Example1.loadMaps(Unknown Source) at Example1.start(Unknown Source) at sun.applet.AppletPanel.run(AppletPanel.java:358) at java.lang.Thread.run(Thread.java:539) [crotwell@heffalump demonstrations]$ ---------------------------------------------------------------------- >Comment By: Ian Turton (ianturton) Date: 2002-01-23 02:56 Message: Logged In: YES user_id=23507 Really it is fixed :-) from the cvs log RCS file: /cvsroot/geotools/geotools/src/uk/ac/leeds/ccg/dbffile/Dbf.java,v Working file: uk/ac/leeds/ccg/dbffile/Dbf.java head: 1.11 branch: locks: strict access list: ... total revisions: 14; selected revisions: 14 description: ---------------------------- revision 1.11 date: 2002/01/17 16:52:48; author: ianturton; state: Exp; lines: +21 -6 change to the way the readers handle badly formated numeric columns ---------------------------- revision 1.10 date: 2002/01/17 15:45:54; author: ianturton; state: Exp; lines: +1 -1 fixed bug in multibyte char reading in getDbfRec ---------------------------- can you send me a cvs status of your version. Cheers Ian ---------------------------------------------------------------------- Comment By: Philip Crotwell (crotwell) Date: 2002-01-22 07:43 Message: Logged In: YES user_id=118526 Hi I don't think this is a duplicate of 504863, and it has not been fixed in CVS as of Jan 22, maybe it just wasn't commited? The String buffer size and the for loop on lines 229-230 in uk/ac/leeds/ccg/dbffile/Dbf.java, method GrabNextDbfRec(), are not compatible. Currently, the code is byte[] strbuf = new byte[DBF_NAMELEN]; // <---- byte array buffer fo storing string's byte data for(int i=0;i<rec_size;i++){ strbuf[i] = dFile.readByte(); // <---- read string's byte data } Either strbuf should be initialized to be size rec_size, or the for loop should be for i<DBF_NAMELEN. From looking at another loop in this same file, I suspect that making strbuf of size rec_size is correct, see line 263. thanks, Philip ---------------------------------------------------------------------- Comment By: Ian Turton (ianturton) Date: 2002-01-18 03:17 Message: Logged In: YES user_id=23507 This was fixed yesterday as part of the fix for bug #504863 ---------------------------------------------------------------------- You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=104091&aid=505061&group_id=4091 |