pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1848359 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSStream.java
Date Thu, 06 Dec 2018 20:11:11 GMT
Author: tilman
Date: Thu Dec  6 20:11:10 2018
New Revision: 1848359

URL: http://svn.apache.org/viewvc?rev=1848359&view=rev
Log:
PDFBOX-2999, PDFBOX-3359: close existing buffer to avoid "ScratchFileBuffer not closed" log
message

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSStream.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSStream.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSStream.java?rev=1848359&r1=1848358&r2=1848359&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSStream.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSStream.java Thu Dec  6 20:11:10
2018
@@ -218,7 +218,8 @@ public class COSStream extends COSDictio
         {
             setItem(COSName.FILTER, filters);
         }
-        randomAccess = scratchFile.createBuffer(); // discards old data - TODO: close existing
buffer?
+        IOUtils.closeQuietly(randomAccess);
+        randomAccess = scratchFile.createBuffer();
         OutputStream randomOut = new RandomAccessOutputStream(randomAccess);
         OutputStream cosOut = new COSOutputStream(getFilterList(), this, randomOut, scratchFile);
         isWriting = true;
@@ -268,7 +269,8 @@ public class COSStream extends COSDictio
         {
             throw new IllegalStateException("Cannot have more than one open stream writer.");
         }
-        randomAccess = scratchFile.createBuffer(); // discards old data - TODO: close existing
buffer?
+        IOUtils.closeQuietly(randomAccess);
+        randomAccess = scratchFile.createBuffer();
         OutputStream out = new RandomAccessOutputStream(randomAccess);
         isWriting = true;
         return new FilterOutputStream(out)



Mime
View raw message