[ 
https://issues.apache.org/jira/browse/LANG-624?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12872917#action_12872917
 ] 

Gary Gregory edited comment on LANG-624 at 5/28/10 12:26 PM:
-------------------------------------------------------------

Committed fix to trunk, unit test improvements and clean ups:

- Fixed and tested (LANG-624) SystemUtils.getJavaVersionAsFloat throws 
StringIndexOutOfBoundsException on Android runtime/Dalvik VM. This is based on 
a new implementation of the underlying code with less reliance of hard coded 
array indices, for example, calls like substring (0, 3).
- Refactored some private methods into one private and one package private 
method such that the latter can be called from unit tests. This allows 
[LANG-624] to be tested along with other methods. See below.
- Removed "dead code" from unit tests: The SystemUtilsTest unit test contained 
code that was cut and pasted from SystemUtils for four constants and associated 
initialization methods. The test methods then called these SystemUtilsTest 
methods instead of the SystemUtils methods. The refactoring allows for the test 
to run against as much of the code in SystemUtils as possible.
- Added assertions for Java version "0", "1.4.2", "1.6" and "1.7" to some tests.
- Added Javadocs to document what happens with "1.6.0_20" vs. "1.6.0", which is 
that the patch level is ignored.



      was (Author: [email protected]):
    Committed fix to trunk, unit test improvements and clean ups:

- Fix (LANG-624) SystemUtils.getJavaVersionAsFloat throws 
StringIndexOutOfBoundsException on Android runtime/Dalvik VM
- Refactor for unit testing.
- Remove odd test code which is copy and pasted from SystemUtils, which 
therefore does not test anything.

  
> SystemUtils.getJavaVersionAsFloat throws StringIndexOutOfBoundsException on 
> Android runtime/Dalvik VM
> -----------------------------------------------------------------------------------------------------
>
>                 Key: LANG-624
>                 URL: https://issues.apache.org/jira/browse/LANG-624
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.*
>    Affects Versions: 2.5, Nightly Builds
>            Reporter: Travis Truman
>             Fix For: 3.0, Nightly Builds
>
>
> Can be replicated in the Android emulator quite easily.
> Stack trace:
> {noformat}
> at 
> org.apache.commons.lang.builder.ToStringBuilder.<clinit>(ToStringBuilder.java:98)
> 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>(ToStringStyle.java:2276)
> E/AndroidRuntime( 1681):      at 
> org.apache.commons.lang.builder.ToStringStyle.<clinit>(ToStringStyle.java:94)
> E/AndroidRuntime( 1681):      ... 18 more
> E/AndroidRuntime( 1681): Caused by: java.lang.StringIndexOutOfBoundsException
> E/AndroidRuntime( 1681):      at java.lang.String.substring(String.java:1571)
> E/AndroidRuntime( 1681):      at 
> org.apache.commons.lang.SystemUtils.getJavaVersionAsFloat(SystemUtils.java:1153)
> E/AndroidRuntime( 1681):      at 
> org.apache.commons.lang.SystemUtils.<clinit>(SystemUtils.java:818)
> {noformat}

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

Reply via email to