aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authoreschaeffer <eschaeffer@unknown>2000-11-24 13:38:36 +0000
committereschaeffer <eschaeffer@unknown>2000-11-24 13:38:36 +0000
commit02ef70293c342a3cb8b7a31f6ef89687e573ba84 (patch)
tree07f12efb2953612d34da993efc2a428eb14e36ce /src
parent2453cf9ec9c47264a48c34507e16c8056bef0c74 (diff)
downloadxmlgraphics-fop-02ef70293c342a3cb8b7a31f6ef89687e573ba84.tar.gz
xmlgraphics-fop-02ef70293c342a3cb8b7a31f6ef89687e573ba84.zip
patch from Stephen Fry
in case of errors, input stream is closed. PR: Obtained from: Submitted by: Reviewed by: git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@193835 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r--src/org/apache/fop/image/FopImageFactory.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/org/apache/fop/image/FopImageFactory.java b/src/org/apache/fop/image/FopImageFactory.java
index fda25c21d..995a62a60 100644
--- a/src/org/apache/fop/image/FopImageFactory.java
+++ b/src/org/apache/fop/image/FopImageFactory.java
@@ -42,6 +42,7 @@ package org.apache.fop.image;
// Java
import java.io.IOException;
+import java.io.InputStream;
import java.net.URL;
import java.net.MalformedURLException;
import java.lang.reflect.Constructor;
@@ -110,14 +111,17 @@ public class FopImageFactory {
// If not, check image type
ImageReader imgReader = null;
+ InputStream imgIS = null;
try {
- imgReader =
- ImageReaderFactory.Make(absoluteURL.openStream());
+ imgIS = absoluteURL.openStream();
+ imgReader = ImageReaderFactory.Make(imgIS);
} catch (Exception e) {
throw new FopImageException(
"Error while recovering Image Informations (" +
absoluteURL.toString() + ") : " + e.getMessage());
- }
+ } finally {
+ try {imgIS.close();} catch (IOException e) {}
+ }
if (imgReader == null)
throw new FopImageException("No ImageReader for this type of image (" +
absoluteURL.toString() + ")");