Author: msahyoun
Date: Sun Mar 11 19:01:27 2018
New Revision: 1826453

URL: http://svn.apache.org/viewvc?rev=1826453&view=rev
Log:
PDFBOX-4071: move getDiskCacheFile into try statement as this will potentially 
cause the SecurityException

Modified:
    
pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/FileSystemFontProvider.java

Modified: 
pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/FileSystemFontProvider.java
URL: 
http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/FileSystemFontProvider.java?rev=1826453&r1=1826452&r2=1826453&view=diff
==============================================================================
--- 
pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/FileSystemFontProvider.java
 (original)
+++ 
pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/FileSystemFontProvider.java
 Sun Mar 11 19:01:27 2018
@@ -291,11 +291,12 @@ final class FileSystemFontProvider exten
     private void saveDiskCache()
     {
         BufferedWriter writer = null;
+        File file = null;
         try
         {
-            File file = getDiskCacheFile();
             try
             {
+                file = getDiskCacheFile();
                 writer = new BufferedWriter(new FileWriter(file));
             }
             catch (SecurityException e)
@@ -377,15 +378,19 @@ final class FileSystemFontProvider exten
         }
         
         List<FSFontInfo> results = new ArrayList<FSFontInfo>();
-        File file = getDiskCacheFile();
+
+        // Get the disk cache
+        File file = null;
         boolean fileExists = false;
         try
         {
+            file = getDiskCacheFile();
             fileExists = file.exists();
         }
         catch (SecurityException e)
         {
         }
+        
         if (fileExists)
         {
             BufferedReader reader = null;


Reply via email to