pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1718928 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/text/PDFTextStripper.java
Date Wed, 09 Dec 2015 18:07:00 GMT
Author: tilman
Date: Wed Dec  9 18:06:59 2015
New Revision: 1718928

URL: http://svn.apache.org/viewvc?rev=1718928&view=rev
Log:
PDFBOX-3155: improve version detection for Java 9, as suggested by Uwe Schindler

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=1718928&r1=1718927&r2=1718928&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 Wed Dec
 9 18:06:59 2015
@@ -116,10 +116,15 @@ public class PDFTextStripper extends PDF
         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;
+            String version = System.getProperty("java.specification.version");
+            StringTokenizer st = new StringTokenizer(version, ".");
+            int majorVersion = Integer.parseInt(st.nextToken());
+            int minorVersion = 0;
+            if (st.hasMoreTokens())
+            {
+                minorVersion = Integer.parseInt(st.nextToken());
+            }
+            is16orLess = majorVersion == 1 && minorVersion <= 6;
         }
         catch (SecurityException x)
         {



Mime
View raw message