pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1812314 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/text/PDFTextStripper.java
Date Mon, 16 Oct 2017 19:14:12 GMT
Author: tilman
Date: Mon Oct 16 19:14:12 2017
New Revision: 1812314

URL: http://svn.apache.org/viewvc?rev=1812314&view=rev
Log:
PDFBOX-2852: avoid NPE, improve message, use jdk7 syntax

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/text/PDFTextStripper.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/text/PDFTextStripper.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/text/PDFTextStripper.java?rev=1812314&r1=1812313&r2=1812314&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/text/PDFTextStripper.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/text/PDFTextStripper.java Mon Oct
16 19:14:12 2017
@@ -1808,27 +1808,23 @@ public class PDFTextStripper extends Leg
     static
     {
         String path = "org/apache/pdfbox/resources/text/BidiMirroring.txt";
-        InputStream input = PDFTextStripper.class.getClassLoader().getResourceAsStream(path);
-        try
+        try (InputStream input = PDFTextStripper.class.getClassLoader().getResourceAsStream(path))
         {
-            parseBidiFile(input);
+            if (input != null)
+            {
+                parseBidiFile(input);
+            }
+            else
+            {
+                LOG.warn("Could not find '" + path + "', mirroring char map will be empty:
");
+            }
+            
         }
         catch (IOException e)
         {
             LOG.warn("Could not parse BidiMirroring.txt, mirroring char map will be empty:
"
                     + e.getMessage());
         }
-        finally
-        {
-            try
-            {
-                input.close();
-            }
-            catch (IOException e)
-            {
-                LOG.error("Could not close BidiMirroring.txt ", e);
-            }
-        }
     }
 
     /**



Mime
View raw message