JDownloader Community - Appwork GmbH
 

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 03.12.2011, 16:24
fcpt
Guest
 
Posts: n/a
Default [JD 15413][AppWorkUtils 1023] getJavaVersion using the wrong variable

JD -----------> revision 15413
AppWorkUtils -> revision 1023

This bug report is 'against' AppWorkUtils, in the function org.appwork.utils.Application.getJavaVersion

In my computer, the String version in that function is assigned with "1.7.0_b147-icedtea"
And I get this errorlog:
Code:
1|org.appwork 03-12-2011 14:02:52 - SEVERE [org.appwork.utils.logging.Log(exception)] -> SEVERE Exception occurred
java.lang.NumberFormatException: null
	at java.lang.Long.parseLong(Long.java:404)
	at java.lang.Long.parseLong(Long.java:483)
	at org.appwork.utils.Application.getJavaVersion(Application.java:151)
	at jd.Main.javaCheck(Main.java:166)
	at jd.Main.preInitChecks(Main.java:345)
	at jd.Main.main(Main.java:240)
1 03-12-2011 14:02:52 - WARNING [jd.Main(javaCheck)] -> Javacheck: Wrong Java Version! JDownloader needs at least Java 1.5 or higher!
The function getJavaVersion:
Code:
    public static long getJavaVersion() {
        if (Application.javaVersion > 0) { return Application.javaVersion; }
        try {
            final String version = System.getProperty("java.version");
            String v = new Regex(version, "^(\\d+\\.\\d+\\.\\d+)").getMatch(0);
            final String u = new Regex(version, "^.*?_(\\d+)").getMatch(0);
            final String b = new Regex(version, "^.*?_b(\\d+)").getMatch(0);
            v = v.replaceAll("\\.", "");
            /* 170uubbb */
            /* eg 1.6 = 16000000 */
            long ret = Long.parseLong(v) * 100000;
            if (u != null) {
                /* append update number */
                ret = ret + Long.parseLong(u) * 1000;
            }
            if (b != null) {
                /* append beta number */
                ret = ret + Long.parseLong(u);
            }
            Application.javaVersion = ret;
            return ret;
        } catch (final Exception e) {
            Log.exception(e);
            return -1;
        }
    }
When the code check if b is not null then inside, the wrong variable is used(u instead of b).

One more thing not important to the code, I would not call that the beta number, but the build number. if it was a beta then "beta" tag is used.
Reply With Quote
  #2  
Old 04.12.2011, 04:46
scr4ve's Avatar
scr4ve scr4ve is offline
JD-Dev & board tech
JD Logo by artcore-illustrations.de
 
Join Date: Feb 2009
Location: Germany, Lower Saxony
Posts: 235
Default

Thank you your investigation of the issue. I really appreciate this - that's what I love about Open Source
By the way, as a developer, you're always welcome at #jdteam on irc.freenode.net.
If you have further questions concerning the (sometimes terribly documented) JD/AppWorkUtils source code,
feel free to ask.

Thanks!
Reply With Quote
  #3  
Old 08.12.2011, 16:00
fcpt
Guest
 
Posts: n/a
Default

Thanks, I love Open Source for the same reason.

It still not reach AppWorkUtils svn.
Reply With Quote
  #4  
Old 08.12.2011, 16:45
scr4ve's Avatar
scr4ve scr4ve is offline
JD-Dev & board tech
JD Logo by artcore-illustrations.de
 
Join Date: Feb 2009
Location: Germany, Lower Saxony
Posts: 235
Default

Quote:
Originally Posted by fcpt View Post
It still not reach AppWorkUtils svn.
Thanks for your reminder. I already fixed it locally but didn't find the time to commit it. Done now
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT +2. The time now is 02:43.
Provided By AppWork GmbH | Privacy | Imprint
Parts of the Design are used from Kirsch designed by Andrew & Austin
Powered by vBulletin® Version 3.8.10 Beta 1
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.