pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1631449 - /pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/util/PDFTextStripper.java
Date Mon, 13 Oct 2014 16:00:15 GMT
Author: tilman
Date: Mon Oct 13 16:00:15 2014
New Revision: 1631449

URL: http://svn.apache.org/r1631449
Log:
PDFBOX-1512: use quicksort if run in an applet

Modified:
    pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/util/PDFTextStripper.java

Modified: pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/util/PDFTextStripper.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/util/PDFTextStripper.java?rev=1631449&r1=1631448&r2=1631449&view=diff
==============================================================================
--- pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/util/PDFTextStripper.java (original)
+++ pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/util/PDFTextStripper.java Mon
Oct 13 16:00:15 2014
@@ -117,10 +117,19 @@ public class PDFTextStripper extends PDF
         // check if we need to use the custom quicksort algorithm as a 
         // workaround to the transitivity issue of TextPositionComparator:
         // https://issues.apache.org/jira/browse/PDFBOX-1512
-        String[] versionComponents = System.getProperty("java.version").split("\\.");
-        int javaMajorVersion = Integer.parseInt(versionComponents[0]);
-        int javaMinorVersion = Integer.parseInt(versionComponents[1]);
-        boolean is16orLess = javaMajorVersion == 1 && javaMinorVersion <= 6;
+        boolean is16orLess = false;
+        try
+        {
+            String[] versionComponents = System.getProperty("java.version").split("\\.");
+            int javaMajorVersion = Integer.parseInt(versionComponents[0]);
+            int javaMinorVersion = Integer.parseInt(versionComponents[1]);
+            is16orLess = javaMajorVersion == 1 && javaMinorVersion <= 6;
+        }
+        catch (SecurityException e)
+        {
+            // when run in an applet ignore and use default
+            // assume 1.7 or higher so that quicksort is used
+        }
         useCustomQuicksort = !is16orLess;
     }
 



Mime
View raw message