|
GeoTiffReader sometimes ends up in a state where resources can't be released.
When trying to read a geotiff file with incomplete information (the attached file e.g. has no coordinate system) using the attached code, I get:
Jun 25, 2014 4:45:51 PM org.geotools.gce.geotiff.GeoTiffReader getHRInfo WARNING: Coordinate Reference System is not available java.lang.IllegalArgumentException: Illegal transform of type "AffineTransform2D". at org.geotools.coverage.grid.GridGeometry2D.inverse(GridGeometry2D.java:644) at org.geotools.coverage.grid.GridGeometry2D.<init>(GridGeometry2D.java:304) at org.geotools.coverage.grid.GridGeometry2D.<init>(GridGeometry2D.java:257) at org.geotools.coverage.grid.GridCoverageFactory.create(GridCoverageFactory.java:545) at org.geotools.gce.geotiff.GeoTiffReader.createCoverage(GeoTiffReader.java:702) at org.geotools.gce.geotiff.GeoTiffReader.read(GeoTiffReader.java:582) at GeoTiffImporter.main(GeoTiffImporter.java:31) Caused by: org.opengis.referencing.operation.NoninvertibleTransformException: Determinant is 0 at org.geotools.referencing.operation.transform.AffineTransform2D.inverse(AffineTransform2D.java:193) at org.geotools.coverage.grid.GridGeometry2D.inverse(GridGeometry2D.java:642) ... 6 more Caused by: java.awt.geom.NoninvertibleTransformException: Determinant is 0 at java.awt.geom.AffineTransform.createInverse(AffineTransform.java:2707) at org.geotools.referencing.operation.transform.AffineTransform2D.inverse(AffineTransform2D.java:189) ... 7 more
After this, I can't get geotools to close the open file. On Linux, this can be shown by running "lsof -p <pid>" while the program is still running (the program sleeps for a minute to make this easier). On Windows, due to mandatory locking, this means the file can't then be moved or deleted.
The same code with a complete geotiff file or a file that's not geotiff at all properly closes the file.
This is a problem for us because we have to watch a directory for files to import, and then move away files afterwards. We don't always have control over the way the users produce the files, which means occasional incorrect files do occur. When running on Windows, this then means we have to restart the software to be able to clean up.
I'm not expecting this file to be read successfully (it is incomplete), but I should be able to clean up resources it uses.
|