DefaultFeatureResults may leave Feature reader open
---------------------------------------------------

                 Key: GEOT-3064
                 URL: http://jira.codehaus.org/browse/GEOT-3064
             Project: GeoTools
          Issue Type: Bug
          Components: data
    Affects Versions: 2.6.3, 2.6.2
         Environment: win32 java1.6
            Reporter: Charles Ballance
            Priority: Trivial


org.geotools.data.DefaultFeatureResults has a side effect error when an error
is raised by feature readers.  It will leave open the feature reader, causing
downstream, non local, errors.  In my case, it left open a shapefile, which
caused errors when trying to update the shapefile(ShpFiles
locking).  The causing error was that the dbf had extra records(my bad, i'm
optimizing the ShapefileReader for my usage).
There are two methods that need fixing:
public ReferencedEnvelope getBounds() {
        ...
                        try {
                                while (reader.hasNext()) {
                                        feature = reader.next();
                                        bounds.include(feature.getBounds());
                                }
                        } finally {
                                reader.close();
                        }
                ...
    }

public int getCount() throws IOException {
...
               try {
                 for (; reader.hasNext(); count++) {
                         reader.next();
                 }
                } finally {
                 reader.close();
             }
....
}


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to