pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From le...@apache.org
Subject svn commit: r1659979 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSStream.java
Date Sun, 15 Feb 2015 18:47:58 GMT
Author: lehmi
Date: Sun Feb 15 18:47:57 2015
New Revision: 1659979

URL: http://svn.apache.org/r1659979
Log:
PDFBOX-2301: don't use deleteOnExit feature as proposed by Timo Boehme

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=1659979&r1=1659978&r2=1659979&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 Sun Feb 15 18:47:57
2015
@@ -68,6 +68,8 @@ public class COSStream extends COSDictio
     private RandomAccessFileOutputStream unFilteredStream;
     private DecodeResult decodeResult;
 
+    private File scratchFile;
+    
     /**
      * Constructor.  Creates a new stream with an empty dictionary.
      *
@@ -139,9 +141,7 @@ public class COSStream extends COSDictio
     {
         try 
         {
-            File scratchFile = File.createTempFile("PDFBox", null, scratchDirectory);
-            // mark scratch file to deleted automatically after usage
-            scratchFile.deleteOnExit();
+            scratchFile = File.createTempFile("PDFBox", null, scratchDirectory);
             return new RandomAccessFile(scratchFile, "rw");
         }
         catch (IOException exception)
@@ -594,5 +594,9 @@ public class COSStream extends COSDictio
         {
             unFilteredStream.close();
         }
+        if (scratchFile != null)
+        {
+            scratchFile.delete();
+        }
     }
 }



Mime
View raw message