Author: tilman
Date: Fri Feb  9 19:13:36 2018
New Revision: 1823694

URL: http://svn.apache.org/viewvc?rev=1823694&view=rev
Log:
PDFBOX-4071: calling close() twice should have no effect

Modified:
    
pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/cos/COSOutputStream.java

Modified: 
pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/cos/COSOutputStream.java
URL: 
http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/cos/COSOutputStream.java?rev=1823694&r1=1823693&r2=1823694&view=diff
==============================================================================
--- 
pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/cos/COSOutputStream.java
 (original)
+++ 
pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/cos/COSOutputStream.java
 Fri Feb  9 19:13:36 2018
@@ -80,6 +80,10 @@ public final class COSOutputStream exten
     @Override
     public void close() throws IOException
     {
+        if (buffer == null)
+        {
+            return;
+        }
         // apply filters in reverse order
         for (int i = filters.size() - 1; i >= 0; i--)
         {
@@ -91,5 +95,6 @@ public final class COSOutputStream exten
         // flush the entire stream
         out.write(buffer.toByteArray());
         super.close();
+        buffer = null;
     }
 }


Reply via email to