pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1783561 - in /pdfbox/branches/2.0/preflight/src/main/java/org/apache/pdfbox/preflight: graphic/ICCProfileWrapper.java process/CatalogValidationProcess.java
Date Sat, 18 Feb 2017 14:54:39 GMT
Author: tilman
Date: Sat Feb 18 14:54:39 2017
New Revision: 1783561

URL: http://svn.apache.org/viewvc?rev=1783561&view=rev
Log:
PDFBOX-2852: close input stream

Modified:
    pdfbox/branches/2.0/preflight/src/main/java/org/apache/pdfbox/preflight/graphic/ICCProfileWrapper.java
    pdfbox/branches/2.0/preflight/src/main/java/org/apache/pdfbox/preflight/process/CatalogValidationProcess.java

Modified: pdfbox/branches/2.0/preflight/src/main/java/org/apache/pdfbox/preflight/graphic/ICCProfileWrapper.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/preflight/src/main/java/org/apache/pdfbox/preflight/graphic/ICCProfileWrapper.java?rev=1783561&r1=1783560&r2=1783561&view=diff
==============================================================================
--- pdfbox/branches/2.0/preflight/src/main/java/org/apache/pdfbox/preflight/graphic/ICCProfileWrapper.java
(original)
+++ pdfbox/branches/2.0/preflight/src/main/java/org/apache/pdfbox/preflight/graphic/ICCProfileWrapper.java
Sat Feb 18 14:54:39 2017
@@ -24,6 +24,7 @@ package org.apache.pdfbox.preflight.grap
 import java.awt.color.ICC_ColorSpace;
 import java.awt.color.ICC_Profile;
 import java.io.IOException;
+import java.io.InputStream;
 import org.apache.pdfbox.cos.COSArray;
 import org.apache.pdfbox.cos.COSBase;
 import org.apache.pdfbox.cos.COSDictionary;
@@ -138,8 +139,15 @@ public class ICCProfileWrapper
                     COSStream stream = COSUtils.getAsStream(destOutputProfile, document.getDocument());
                     if (stream != null)
                     {
-                        ICC_Profile iccp = ICC_Profile.getInstance(stream.createInputStream());
-                        return new ICCProfileWrapper(iccp);
+                        InputStream is = stream.createInputStream();
+                        try
+                        {
+                            return new ICCProfileWrapper(ICC_Profile.getInstance(is));
+                        }
+                        finally
+                        {
+                            is.close();
+                        }
                     }
                 }
                 catch (IllegalArgumentException e)

Modified: pdfbox/branches/2.0/preflight/src/main/java/org/apache/pdfbox/preflight/process/CatalogValidationProcess.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/preflight/src/main/java/org/apache/pdfbox/preflight/process/CatalogValidationProcess.java?rev=1783561&r1=1783560&r2=1783561&view=diff
==============================================================================
--- pdfbox/branches/2.0/preflight/src/main/java/org/apache/pdfbox/preflight/process/CatalogValidationProcess.java
(original)
+++ pdfbox/branches/2.0/preflight/src/main/java/org/apache/pdfbox/preflight/process/CatalogValidationProcess.java
Sat Feb 18 14:54:39 2017
@@ -23,6 +23,7 @@ package org.apache.pdfbox.preflight.proc
 
 import java.awt.color.ICC_Profile;
 import java.io.IOException;
+import java.io.InputStream;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -357,7 +358,16 @@ public class CatalogValidationProcess ex
                 return;
             }
 
-            ICC_Profile iccp = ICC_Profile.getInstance(stream.createInputStream());
+            InputStream is = stream.createInputStream();
+            ICC_Profile iccp = null;
+            try
+            {
+                iccp = ICC_Profile.getInstance(is);
+            }
+            finally
+            {
+                is.close();
+            }
             
             if (!validateICCProfileNEntry(stream, ctx, iccp))
             {



Mime
View raw message