aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJeremias Maerki <jeremias@apache.org>2005-08-31 08:53:25 +0000
committerJeremias Maerki <jeremias@apache.org>2005-08-31 08:53:25 +0000
commitf0763b71e182a6192769cda1bca740e05b21f2c3 (patch)
tree19f6b269e282f348c7ae4927e21bf7498405b80a /src
parent11eb39ca2467133c493933812b573809911c9c3b (diff)
downloadxmlgraphics-fop-f0763b71e182a6192769cda1bca740e05b21f2c3.tar.gz
xmlgraphics-fop-f0763b71e182a6192769cda1bca740e05b21f2c3.zip
Bugzilla #36432:
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
Diffstat (limited to 'src')
-rw-r--r--src/java/org/apache/fop/image/ImageFactory.java9
-rw-r--r--src/java/org/apache/fop/image/JAIImage.java6
2 files changed, 14 insertions, 1 deletions
diff --git a/src/java/org/apache/fop/image/ImageFactory.java b/src/java/org/apache/fop/image/ImageFactory.java
index bc2258958..8379cda85 100644
--- a/src/java/org/apache/fop/image/ImageFactory.java
+++ b/src/java/org/apache/fop/image/ImageFactory.java
@@ -594,6 +594,15 @@ class ImageProvider {
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;
}
diff --git a/src/java/org/apache/fop/image/JAIImage.java b/src/java/org/apache/fop/image/JAIImage.java
index c5fcd2304..5e71f9902 100644
--- a/src/java/org/apache/fop/image/JAIImage.java
+++ b/src/java/org/apache/fop/image/JAIImage.java
@@ -75,9 +75,10 @@ public class JAIImage extends AbstractFopImage {
*/
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();
@@ -167,6 +168,9 @@ public class JAIImage extends AbstractFopImage {
} finally {
IOUtils.closeQuietly(inputStream);
inputStream = null;
+ if (imageOp != null) {
+ imageOp.dispose();
+ }
if (seekableInput != null) {
IOUtils.closeQuietly(seekableInput);
}