#1
|
|||
|
|||
[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! 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; } } 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. |
#2
|
||||
|
||||
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! |
#3
|
|||
|
|||
Thanks, I love Open Source for the same reason.
It still not reach AppWorkUtils svn. |
#4
|
||||
|
||||
Thanks for your reminder. I already fixed it locally but didn't find the time to commit it. Done now
|
Thread Tools | |
Display Modes | |
|
|