pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1725483 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/image/PDImageXObject.java
Date Tue, 19 Jan 2016 11:55:24 GMT
Author: tilman
Date: Tue Jan 19 11:55:24 2016
New Revision: 1725483

URL: http://svn.apache.org/viewvc?rev=1725483&view=rev
Log:
PDFBOX-3199: close stream

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/image/PDImageXObject.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/image/PDImageXObject.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/image/PDImageXObject.java?rev=1725483&r1=1725482&r2=1725483&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/image/PDImageXObject.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/image/PDImageXObject.java
Tue Jan 19 11:55:24 2016
@@ -188,7 +188,10 @@ public final class PDImageXObject extend
         String ext = name.substring(dot + 1).toLowerCase();
         if ("jpg".equals(ext) || "jpeg".equals(ext))
         {
-            return JPEGFactory.createFromStream(doc, new FileInputStream(file));
+            FileInputStream fis = new FileInputStream(file);
+            PDImageXObject imageXObject = JPEGFactory.createFromStream(doc, fis);
+            fis.close();
+            return imageXObject;
         }
         if ("tif".equals(ext) || "tiff".equals(ext))
         {
@@ -244,7 +247,10 @@ public final class PDImageXObject extend
 
         if (fileType.equals(FileType.JPEG))
         {
-            return JPEGFactory.createFromStream(doc, new FileInputStream(file));
+            FileInputStream fis = new FileInputStream(file);
+            PDImageXObject imageXObject = JPEGFactory.createFromStream(doc, fis);
+            fis.close();
+            return imageXObject;
         }
         if (fileType.equals(FileType.TIFF))
         {



Mime
View raw message