[ 
https://issues.apache.org/jira/browse/CXF-6811?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15175932#comment-15175932
 ] 

Alessio Soldano commented on CXF-6811:
--------------------------------------

I would actually suggest removing that method, as it does not seem to be used 
anywhere in Apache CXF sources and from a user point of view it does not add a 
lot on top of a basic System.getProperty("java.version") .

> org.apache.cxf.common.util.ClassHelper.getJavaVersion() method will fail on 
> JDK9
> --------------------------------------------------------------------------------
>
>                 Key: CXF-6811
>                 URL: https://issues.apache.org/jira/browse/CXF-6811
>             Project: CXF
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 3.1.5
>            Reporter: Richard Opalka
>
> JDK9 will come with new versioning scheme, see:
> http://openjdk.java.net/jeps/223
> We identified the following snippet of code to be problematic for JDK9 
> adoption:
> org.apache.cxf.common.util.ClassHelper
> {code}
> public static double getJavaVersion() {
>     String version = System.getProperty("java.version");
>     return Double.parseDouble(version.substring(0, 3));
> }
> {code}
> ATM this code fails on:
> Exception in thread "main" java.lang.NumberFormatException: For input string: 
> "9-e"
>       at 
> jdk.internal.math.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:2054)
>       at 
> jdk.internal.math.FloatingDecimal.parseDouble(FloatingDecimal.java:110)
>       at java.lang.Double.parseDouble(Double.java:539)
>       at 
> org.apache.cxf.common.util.ClassHelper.getJavaVersion(ClassHelper.java:90)
> with Early access JDK9.
> Once official JDK9 is released this code will fail on 
> StringIndexOutOfBoundsException.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to