pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1567327 - /pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/xobject/PDCcitt.java
Date Tue, 11 Feb 2014 19:34:41 GMT
Author: tilman
Date: Tue Feb 11 19:34:40 2014
New Revision: 1567327

URL: http://svn.apache.org/r1567327
Log:
PDFBOX-1909: Close open streams

Modified:
    pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/xobject/PDCcitt.java

Modified: pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/xobject/PDCcitt.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/xobject/PDCcitt.java?rev=1567327&r1=1567326&r2=1567327&view=diff
==============================================================================
--- pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/xobject/PDCcitt.java
(original)
+++ pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/xobject/PDCcitt.java
Tue Feb 11 19:34:40 2014
@@ -182,7 +182,9 @@ public class PDCcitt extends PDXObjectIm
         WritableRaster raster = colorModel.createCompatibleWritableRaster(cols, rows);
         DataBufferByte buffer = (DataBufferByte) raster.getDataBuffer();
         bufferData = buffer.getData();
-        IOUtils.populateBuffer(stream.getUnfilteredStream(), bufferData);
+        InputStream is = stream.getUnfilteredStream();
+        IOUtils.populateBuffer(is, bufferData);
+        IOUtils.closeQuietly(is);
         BufferedImage image = new BufferedImage(colorModel, raster, false, null);
         if (!blackIsOne)
         {
@@ -229,6 +231,7 @@ public class PDCcitt extends PDXObjectIm
         // We should use another format than TIFF to get rid of the TiffWrapper
         InputStream data = new TiffWrapper(getPDStream().getPartiallyFilteredStream(FAX_FILTERS),
getCOSStream());
         IOUtils.copy(data, out);
+        IOUtils.closeQuietly(data);
     }
 
     /**



Mime
View raw message