Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 2.5-M0
-
Fix Version/s: 2.5-M1
-
Component/s: None
-
Labels:None
Description
WorldImageFormat is not set up to protect against bad mojo at the ImageIO level...
java.lang.NoClassDefFoundError at it.geosolutions.imageio.gdalframework.GDALImageReaderSpi.canDecodeInput(GDALImageReaderSpi.java:216) at it.geosolutions.imageio.plugins.mrsid.MrSIDImageReaderSpi.canDecodeInput(MrSIDImageReaderSpi.java:105) at javax.imageio.ImageIO$CanDecodeInputFilter.filter(ImageIO.java:526) at javax.imageio.spi.FilterIterator.advance(ServiceRegistry.java:793) at javax.imageio.spi.FilterIterator.next(ServiceRegistry.java:811) at javax.imageio.ImageIO$ImageReaderIterator.next(ImageIO.java:487) at javax.imageio.ImageIO$ImageReaderIterator.next(ImageIO.java:472) at org.geotools.gce.image.WorldImageReader.getHRInfo(WorldImageReader.java:262) at org.geotools.gce.image.WorldImageReader.<init>(WorldImageReader.java:231) at org.geotools.gce.image.WorldImageFormat.getReader(WorldImageFormat.java:341) at org.geotools.gce.image.WorldImageFormat.getReader(WorldImageFormat.java:162)
The code was grabbing the first format off the iterator and hoping for the best; it was not set up tohandle a ClassNotFound exception
(or indeed catch any exception).
I have patched the getHRInfo method as follows:
final Iterator it = ImageIO.getImageReaders(inStream); ImageReader r = null; while( r == null && it.hasNext() ){ try { r = (ImageReader) it.next(); } catch( NoClassDefFoundError probablyMissingDLLs ){ LOGGER.log(Level.FINE, probablyMissingDLLs.getLocalizedMessage(), probablyMissingDLLs); } } if( r == null ){ throw new DataSourceException("No reader avalaible for this source"); } final ImageReader reader = (ImageReader) r;
What do you think?
But since NoClassDefFoundError is an Error we need to try / catch (Exception ) / catch (Error ) ...
I will patch over there...
Jody