Return-Path: X-Original-To: apmail-pdfbox-dev-archive@www.apache.org Delivered-To: apmail-pdfbox-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 587291872B for ; Mon, 7 Dec 2015 14:01:11 +0000 (UTC) Received: (qmail 90434 invoked by uid 500); 7 Dec 2015 14:01:11 -0000 Delivered-To: apmail-pdfbox-dev-archive@pdfbox.apache.org Received: (qmail 90409 invoked by uid 500); 7 Dec 2015 14:01:11 -0000 Mailing-List: contact dev-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 dev@pdfbox.apache.org Received: (qmail 90391 invoked by uid 99); 7 Dec 2015 14:01:11 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 07 Dec 2015 14:01:11 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id E37932C14DC for ; Mon, 7 Dec 2015 14:01:10 +0000 (UTC) Date: Mon, 7 Dec 2015 14:01:10 +0000 (UTC) From: "Uwe Schindler (JIRA)" To: dev@pdfbox.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (PDFBOX-3155) org.apache.pdfbox.util.PDFTextStripper class initialization throws NumberFormatException with recent Verona-enabled Java 9 JVMs MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/PDFBOX-3155?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15044986#comment-15044986 ] Uwe Schindler commented on PDFBOX-3155: --------------------------------------- The stack trace we have seen: {noformat} Caused by: java.lang.NumberFormatException: For input string: "9-ea" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) at java.lang.Integer.parseInt(Integer.java:675) at java.lang.Integer.parseInt(Integer.java:793) at org.apache.pdfbox.util.PDFTextStripper.(PDFTextStripper.java:122) ... 57 more {noformat} If the "-ea" would not be part of the string (e.g. final release of Java 9), it would fail with ArrayIndexOutOfBoundsException in the following line. See http://openjdk.java.net/jeps/223 for new version number formats, so be prepared and don't fail code with exceptions caused by missing consistency checks. > org.apache.pdfbox.util.PDFTextStripper class initialization throws NumberFormatException with recent Verona-enabled Java 9 JVMs > ------------------------------------------------------------------------------------------------------------------------------- > > Key: PDFBOX-3155 > URL: https://issues.apache.org/jira/browse/PDFBOX-3155 > Project: PDFBox > Issue Type: Bug > Affects Versions: 1.8.8, 1.8.10 > Reporter: Uwe Schindler > Priority: Critical > > Lucene/Solr runs its whole testsuite also with Java 9 EA releases to trigger bugs early. In our tests (Solr + TIKA) we found out that org.apache.pdfbox.util.PDFTextStripper throws a NumberFormatException in its static initializer when parsing the "java.version" system property. The reason for failure is a change in Java 9, where version numbers got a new format. > There are 2 problems: > - It should not assume that all components are really a number. So it should try/catch NumberFormatException and assign some "unknown" version > - The code should really use "java.specification.version". This is standardized and only contains digits. > - The code should also be prepared to handle version numbers without minor version! E.g. Java 9 only has "9" instead of "1.9" as its main version number. > For the use case I would nuke this check and find a better workaround. > Relying on String parsing for non-standardized system properties in a static class initializer is the reason why this bug is raised to level "Critical". -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org For additional commands, e-mail: dev-help@pdfbox.apache.org