commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Henri Yandell (JIRA)" <>
Subject [jira] Commented: (LANG-624) SystemUtils.getJavaVersionAsFloat throws StringIndexOutOfBoundsException on Android runtime/Dalvik VM
Date Sun, 23 Jan 2011 06:02:16 GMT


Henri Yandell commented on LANG-624:

Digging deeper into SystemUtils and specifically what I think should change:

JAVA_VERSION: Keep as is. It's fair to expect it to point to java.version. That that is the
vendor version should be noted in the javadoc.

JAVA_VERSION_TRIMMED: We shouldn't be trying to parse the specification version out of java.version.
Remove this. 

getJavaVersionTrimmed(): Private method for the above. Also remove.

JAVA_VERSION_FLOAT: This now becomes impossible. Remove this - I don't think there's huge
need to have code only run on 1.6.1 of a JVM. Sure it might be a good way to get around some
bug in 1.6.0, but the code becomes inherently unportable.

JAVA_VERSION_INT: Same as above. Remove.

getJavaVersionMatches: Move this over to using JAVA_SPECIFICATION_VERSION. 

isJavaVersionAtLeast: Move to spec version. This means having a private Float version(?).
Drop the int variant of this method as it's silly to pass in 13 instead of 1.3. In general
this is a silly method; the better solution imo would be to have a JAVA_1_2 enum :) I wonder
if that's something we should consider for all of the IS_XYZ 'constants'?

> SystemUtils.getJavaVersionAsFloat throws StringIndexOutOfBoundsException on Android runtime/Dalvik
> -----------------------------------------------------------------------------------------------------
>                 Key: LANG-624
>                 URL:
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.*
>    Affects Versions: 2.5
>            Reporter: Travis Truman
>             Fix For: 3.0
>         Attachments: AndriodJavaVersion.png
> Can be replicated in the Android emulator quite easily.
> Stack trace:
> {noformat}
> at org.apache.commons.lang.builder.ToStringBuilder.<clinit>(
> E/AndroidRuntime( 1681): 	... 17 more
> E/AndroidRuntime( 1681): Caused by: java.lang.ExceptionInInitializerError
> E/AndroidRuntime( 1681): 	at org.apache.commons.lang.builder.ToStringStyle$MultiLineToStringStyle.<init>(
> E/AndroidRuntime( 1681): 	at org.apache.commons.lang.builder.ToStringStyle.<clinit>(
> E/AndroidRuntime( 1681): 	... 18 more
> E/AndroidRuntime( 1681): Caused by: java.lang.StringIndexOutOfBoundsException
> E/AndroidRuntime( 1681): 	at java.lang.String.substring(
> E/AndroidRuntime( 1681): 	at org.apache.commons.lang.SystemUtils.getJavaVersionAsFloat(
> E/AndroidRuntime( 1681): 	at org.apache.commons.lang.SystemUtils.<clinit>(
> {noformat}

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message