commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 32133] - SystemUtils fails init on HP-UX
Date Tue, 09 Nov 2004 22:10:35 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=32133>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=32133

SystemUtils fails init on HP-UX





------- Additional Comments From gritmaj@wyeth.com  2004-11-09 22:10 -------
I changed the following three methods to fix the issue:

    private static float getJavaVersionAsFloat() {
        if (JAVA_VERSION == null) {
            return 0f;
        }
        String trimmedVersion = trimJavaVersion();
        String str = trimmedVersion.substring(0, 3);
        if (trimmedVersion.length() >= 5) {
            str = str + trimmedVersion.substring(4, 5);
        }
        return Float.parseFloat(str);
    }
    
    private static int getJavaVersionAsInt() {
        if (JAVA_VERSION == null) {
            return 0;
        }
        String trimmedVersion = trimJavaVersion();
        String str = JAVA_VERSION.substring(0, 1);
        str = str + JAVA_VERSION.substring(2, 3);
        if (JAVA_VERSION.length() >= 5) {
            str = str + JAVA_VERSION.substring(4, 5);
        } else {
            str = str + "0";
        }
        return Integer.parseInt(str);
    }

    private static String trimJavaVersion()
    {
        if (Character.isDigit(JAVA_VERSION.charAt(0)))
        {
            return JAVA_VERSION.substring(
                    StringUtils.indexOf(JAVA_VERSION, "0123456789"));
            
        }
        else
        {
            return JAVA_VERSION;
        }
    }

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message