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);
     }
 
     /**


Reply via email to