Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 2B147200B8B for ; Tue, 4 Oct 2016 18:53:23 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 29BFB160ADC; Tue, 4 Oct 2016 16:53:23 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 65E30160AC7 for ; Tue, 4 Oct 2016 18:53:22 +0200 (CEST) Received: (qmail 28422 invoked by uid 500); 4 Oct 2016 16:53:21 -0000 Mailing-List: contact commits-help@pdfbox.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@pdfbox.apache.org Delivered-To: mailing list commits@pdfbox.apache.org Received: (qmail 28413 invoked by uid 99); 4 Oct 2016 16:53:21 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 Oct 2016 16:53:21 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 2C902C0B9A for ; Tue, 4 Oct 2016 16:53:21 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -1.199 X-Spam-Level: X-Spam-Status: No, score=-1.199 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RP_MATCHES_RCVD=-2.999] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id GsLrg_gTBlJ4 for ; Tue, 4 Oct 2016 16:53:20 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 529045FBCF for ; Tue, 4 Oct 2016 16:53:19 +0000 (UTC) Received: from svn01-us-west.apache.org (svn.apache.org [10.41.0.6]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 73D91E06C1 for ; Tue, 4 Oct 2016 16:53:18 +0000 (UTC) Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id 71B9E3A0248 for ; Tue, 4 Oct 2016 16:53:18 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1763301 - in /pdfbox/trunk: fontbox/src/main/java/org/apache/fontbox/util/autodetect/WindowsFontDirFinder.java pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/FileSystemFontProvider.java Date: Tue, 04 Oct 2016 16:53:18 -0000 To: commits@pdfbox.apache.org From: tilman@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20161004165318.71B9E3A0248@svn01-us-west.apache.org> archived-at: Tue, 04 Oct 2016 16:53:23 -0000 Author: tilman Date: Tue Oct 4 16:53:18 2016 New Revision: 1763301 URL: http://svn.apache.org/viewvc?rev=1763301&view=rev Log: PDFBOX-3520: more resiliency against security manager fails Modified: pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/util/autodetect/WindowsFontDirFinder.java pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/FileSystemFontProvider.java Modified: pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/util/autodetect/WindowsFontDirFinder.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/util/autodetect/WindowsFontDirFinder.java?rev=1763301&r1=1763300&r2=1763301&view=diff ============================================================================== --- pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/util/autodetect/WindowsFontDirFinder.java (original) +++ pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/util/autodetect/WindowsFontDirFinder.java Tue Oct 4 16:53:18 2016 @@ -82,6 +82,10 @@ public class WindowsFontDirFinder implem { // should continue if this fails } + catch (SecurityException e) + { + // should continue if this fails + } } File osFontsDir; File psFontsDir; @@ -111,20 +115,34 @@ public class WindowsFontDirFinder implem { osFontsDir = new File(driveLetter + ":" + File.separator + windowsDirName + File.separator + "FONTS"); - if (osFontsDir.exists() && osFontsDir.canRead()) + try { - fontDirList.add(osFontsDir); - break; + if (osFontsDir.exists() && osFontsDir.canRead()) + { + fontDirList.add(osFontsDir); + break; + } + } + catch (SecurityException e) + { + // should continue if this fails } } // look for type 1 font folder for (char driveLetter = 'C'; driveLetter <= 'E'; driveLetter++) { psFontsDir = new File(driveLetter + ":" + File.separator + "PSFONTS"); - if (psFontsDir.exists() && psFontsDir.canRead()) + try + { + if (psFontsDir.exists() && psFontsDir.canRead()) + { + fontDirList.add(psFontsDir); + break; + } + } + catch (SecurityException e) { - fontDirList.add(psFontsDir); - break; + // should continue if this fails } } } Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/FileSystemFontProvider.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/FileSystemFontProvider.java?rev=1763301&r1=1763300&r2=1763301&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/FileSystemFontProvider.java (original) +++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/FileSystemFontProvider.java Tue Oct 4 16:53:18 2016 @@ -285,7 +285,14 @@ final class FileSystemFontProvider exten try { File file = getDiskCacheFile(); - writer = new BufferedWriter(new FileWriter(file)); + try + { + writer = new BufferedWriter(new FileWriter(file)); + } + catch (SecurityException e) + { + return; + } for (FSFontInfo fontInfo : fontInfoList) { @@ -360,7 +367,15 @@ final class FileSystemFontProvider exten List results = new ArrayList(); File file = getDiskCacheFile(); - if (file.exists()) + boolean fileExists = false; + try + { + fileExists = file.exists(); + } + catch (SecurityException e) + { + } + if (fileExists) { BufferedReader reader = null; try