You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by je...@apache.org on 2005/08/31 10:53:29 UTC

svn commit: r264978 - in /xmlgraphics/fop/trunk/src/java/org/apache/fop/image: ImageFactory.java JAIImage.java

Author: jeremias
Date: Wed Aug 31 01:53:25 2005
New Revision: 264978

URL: http://svn.apache.org/viewcvs?rev=264978&view=rev
Log:
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.

Modified:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/image/ImageFactory.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/image/JAIImage.java

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/image/ImageFactory.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/image/ImageFactory.java?rev=264978&r1=264977&r2=264978&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/image/ImageFactory.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/image/ImageFactory.java Wed Aug 31 01:53:25 2005
@@ -594,6 +594,15 @@
                 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;
         }

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/image/JAIImage.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/image/JAIImage.java?rev=264978&r1=264977&r2=264978&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/image/JAIImage.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/image/JAIImage.java Wed Aug 31 01:53:25 2005
@@ -75,9 +75,10 @@
      */
     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 @@
         } finally {
             IOUtils.closeQuietly(inputStream);
             inputStream = null;
+            if (imageOp != null) {
+                imageOp.dispose();
+            }
             if (seekableInput != null) {
                 IOUtils.closeQuietly(seekableInput);
             }



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org