You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2019/01/23 20:35:16 UTC

[cxf] branch master updated: Get rid of IndexArrayOutOfBounds

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

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


The following commit(s) were added to refs/heads/master by this push:
     new dfa3dfe  Get rid of IndexArrayOutOfBounds
dfa3dfe is described below

commit dfa3dfea750c4d96e46781c6f2f8b5a183b9c97c
Author: Breeki32 <41...@users.noreply.github.com>
AuthorDate: Wed Jan 23 21:02:59 2019 +0100

    Get rid of IndexArrayOutOfBounds
    
    If an environment defines the java.version with 1.8.0 this code will die with an ArrayIndexOutOfBoundsEx.
    
    To evade this either the length of the version should be checked for being >6 or, as proposed in the pr, the 1.8.0 version format should be checked for an additional underscore - if its not there then the environment uses something different than the expected value like 1.8.0_161. But it should never die with an AIOB-Ex. Thank you.
---
 core/src/main/java/org/apache/cxf/helpers/JavaUtils.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/core/src/main/java/org/apache/cxf/helpers/JavaUtils.java b/core/src/main/java/org/apache/cxf/helpers/JavaUtils.java
index 52ad836..6224cc4 100644
--- a/core/src/main/java/org/apache/cxf/helpers/JavaUtils.java
+++ b/core/src/main/java/org/apache/cxf/helpers/JavaUtils.java
@@ -53,7 +53,7 @@ public final class JavaUtils {
     static {
         String version = System.getProperty("java.version");
         try {
-            isJava8Before161 = version != null && version.startsWith("1.8.0")
+            isJava8Before161 = version != null && version.startsWith("1.8.0_")
                 && Integer.parseInt(version.substring(6)) < 161;
         } catch (NumberFormatException ex) {
             isJava8Before161 = false;