JAI image does not release all resources - reported by Stephen Denne - thanks!
When loading an image provider whose support libraries are missing an
exception is thrown which should really only be a warning and the next provider
be tried.
Submitted by: Manuel Mall <mm.at.arcus.com.au>
Changes to the patch by JM:
Log level for the warning changed to debug() because the binary distribution is compiled with JAI and JIMI support and this will cause a lot of inappropriate warnings for people just happy with ImageIO images.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@264978
13f79535-47bb-0310-9956-
ffa450edef68
clazz = Class.forName(getClassName());
} catch (ClassNotFoundException cnfe) {
//nop
+ } catch (LinkageError le) {
+ // This can happen if fop was build with support for a
+ // particular provider (e.g. a binary fop distribution)
+ // but the required support files (e.g. jai, jimi) are not
+ // available in the current runtime environment.
+ ImageFactory.log.debug("Image support provider " + getName()
+ + " could not be loaded. If " + getName() + " should be"
+ + " available please make sure all required external libraries"
+ + " are on the classpath.");
}
checked = true;
}
*/
protected void loadImage() {
com.sun.media.jai.codec.FileCacheSeekableStream seekableInput = null;
+ RenderedOp imageOp = null;
try {
seekableInput = new FileCacheSeekableStream(inputStream);
- RenderedOp imageOp = JAI.create("stream", seekableInput);
+ imageOp = JAI.create("stream", seekableInput);
this.height = imageOp.getHeight();
this.width = imageOp.getWidth();
} finally {
IOUtils.closeQuietly(inputStream);
inputStream = null;
+ if (imageOp != null) {
+ imageOp.dispose();
+ }
if (seekableInput != null) {
IOUtils.closeQuietly(seekableInput);
}