pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1647118 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/NonSequentialPDFParser.java
Date Sun, 21 Dec 2014 10:34:36 GMT
Author: tilman
Date: Sun Dec 21 10:34:36 2014
New Revision: 1647118

URL: http://svn.apache.org/r1647118
Log:
PDFBOX-2576: use IOUtils.closeQuietly where possible

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/NonSequentialPDFParser.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/NonSequentialPDFParser.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/NonSequentialPDFParser.java?rev=1647118&r1=1647117&r2=1647118&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/NonSequentialPDFParser.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/NonSequentialPDFParser.java
Sun Dec 21 10:34:36 2014
@@ -766,7 +766,6 @@ public class NonSequentialPDFParser exte
      */
     protected final void setPdfSource(long fileOffset) throws IOException
     {
-
         pdfSource.seek(fileOffset);
 
         // alternative using 'old fashioned' input stream
@@ -790,14 +789,6 @@ public class NonSequentialPDFParser exte
         // pdfSource.close();
     }
 
-    private void closeFileStream() throws IOException
-    {
-        if (pdfSource != null)
-        {
-            pdfSource.close();
-        }
-    }
-
     // ------------------------------------------------------------------------
     /**
      * Looks for and parses startxref. We first look for last '%%EOF' marker (within last
@@ -842,16 +833,7 @@ public class NonSequentialPDFParser exte
         }
         finally
         {
-            if (fIn != null)
-            {
-                try
-                {
-                    fIn.close();
-                }
-                catch (IOException ioe)
-                {
-                }
-            }
+            IOUtils.closeQuietly(fIn);
         }
 
         // ---- find last '%%EOF'
@@ -991,6 +973,7 @@ public class NonSequentialPDFParser exte
 
     // ------------------------------------------------------------------------
     /** Parses all objects needed by pages and closes input stream. */
+    
     /**
      * {@inheritDoc}
      */
@@ -1030,21 +1013,12 @@ public class NonSequentialPDFParser exte
         }
         finally
         {
-            try
-            {
-                closeFileStream();
-                if (keyStoreInputStream != null)
-                {
-                    keyStoreInputStream.close();
-                }
-            }
-            catch (IOException ioe)
-            {
-            }
+            IOUtils.closeQuietly(pdfSource);
+            IOUtils.closeQuietly(keyStoreInputStream);
 
             deleteTempFile();
 
-            if (exceptionOccurred && (document != null))
+            if (exceptionOccurred && document != null)
             {
                 try
                 {



Mime
View raw message