Jody Garnett wrote:
> ShapeFileReader.getCount
> - takes with readRecord until readRecord returns -1
>
> This loop finds 3 features when using the "jar:/...." URL and 49 when
> using the "file:/..." URL - cannot figure out the bug so far.
>
ShapeFileReader has a loop near the end of readRecord() ... where it
looks looks like the buffer is refilled when the remaining bytes are not
big enough for a complete record.
> while (buffer.limit() < buffer.position() + recordlength) {
> recordlength -= buffer.limit() - buffer.position();
> buffer.clear();
> if (channel.read(buffer) < 1) {
> return -1;
> }
> }
It is this loop that behaves differently between the "jar:/..." and
"file:/.." cases. In the jar case is simply loops until the channel is
empy, and -1 is returned. That is it loops over and skips every single
other feature that is not contained in the first read..
In the file case the buffer is never exhausted and this loop of doom
never abused.
I have changed the test to return size>0, and ask that it be looked into.
Please,
Jody
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel