You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by rz...@apache.org on 2021/09/20 07:56:40 UTC

[tomee] branch master updated: TOMEE-3794 - javaVersion() in org.apache.openejb.arquillian.common.Setup breaks for version strings with length lower than 3

This is an automated email from the ASF dual-hosted git repository.

rzo1 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomee.git


The following commit(s) were added to refs/heads/master by this push:
     new 298bbb0  TOMEE-3794 - javaVersion() in org.apache.openejb.arquillian.common.Setup breaks for version strings with length lower than 3
298bbb0 is described below

commit 298bbb0a1d1fe345347ed4b742da6e9ce59a6e69
Author: Richard Zowalla <rz...@apache.org>
AuthorDate: Mon Sep 20 09:56:31 2021 +0200

    TOMEE-3794 - javaVersion() in org.apache.openejb.arquillian.common.Setup breaks for version strings with length lower than 3
---
 .../src/main/java/org/apache/openejb/arquillian/common/Setup.java | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/arquillian/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/Setup.java b/arquillian/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/Setup.java
index 884bac9..0afb7d6 100644
--- a/arquillian/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/Setup.java
+++ b/arquillian/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/Setup.java
@@ -57,7 +57,13 @@ public class Setup {
 
     private static double javaVersion() {
         try {
-            return Double.parseDouble(System.getProperty("java.version", "1.7").substring(0, 3));
+            String version = System.getProperty("java.version", "1.7");
+
+            if(version.length() > 3) {
+                version = version.substring(0, 3);
+            }
+
+            return Double.parseDouble(version);
         } catch (final Exception nfe) {
             return 1.6;
         }