Changeset 04a985cd for apps


Ignore:
Timestamp:
May 12, 2019 8:20:13 PM (11 months ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
e174a46
Parents:
adb1c6f
Message:

Consolidate Java version checking code, fix bugs
where versions are in different forms
Add warning about Java 7

Location:
apps/routerconsole/java/src/net/i2p/router
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • apps/routerconsole/java/src/net/i2p/router/update/NewsFetcher.java

    radb1c6f r04a985cd  
    265265                            String minJava = args.get(MIN_JAVA_VERSION_KEY);
    266266                            if (minJava != null) {
    267                                 String ourJava = System.getProperty("java.version");
    268                                 if (VersionComparator.comp(ourJava, minJava) < 0) {
     267                                if (!SystemVersion.isJava(minJava)) {
     268                                    String ourJava = System.getProperty("java.version");
    269269                                    String msg = _mgr._t("Requires Java version {0} but installed Java version is {1}", minJava, ourJava);
    270270                                    _log.logAlways(Log.WARN, "Cannot update to version " + ver + ": " + msg);
  • apps/routerconsole/java/src/net/i2p/router/update/PluginUpdateRunner.java

    radb1c6f r04a985cd  
    410410
    411411            minVersion = PluginStarter.stripHTML(props, "min-java-version");
    412             if (minVersion != null &&
    413                 VersionComparator.comp(System.getProperty("java.version"), minVersion) < 0) {
     412            if (minVersion != null && !SystemVersion.isJava(minVersion)) {
    414413                to.delete();
    415414                statusDone("<b>" + _t("This plugin requires Java version {0} or higher", minVersion) + "</b>");
  • apps/routerconsole/java/src/net/i2p/router/web/PluginStarter.java

    radb1c6f r04a985cd  
    359359
    360360        minVersion = stripHTML(props, "min-java-version");
    361         if (minVersion != null &&
    362             VersionComparator.comp(System.getProperty("java.version"), minVersion) < 0) {
     361        if (minVersion != null && !SystemVersion.isJava(minVersion)) {
    363362            String foo = "Plugin " + appName + " requires Java version " + minVersion + " or higher";
    364363            log.error(foo);
  • apps/routerconsole/java/src/net/i2p/router/web/RouterConsoleRunner.java

    radb1c6f r04a985cd  
    341341    /** @since 0.9.17 */
    342342    private void checkJavaVersion() {
    343         boolean noJava7 = !SystemVersion.isJava7();
     343        boolean noJava8 = !SystemVersion.isJava8();
    344344        boolean noPack200 = (PluginStarter.pluginsEnabled(_context) || !NewsHelper.isUpdateDisabled(_context)) &&
    345345                            !FileUtil.isPack200Supported();
     
    347347        boolean isZero = SystemVersion.isZeroVM();
    348348        boolean isJava11 = false; // SystemVersion.isJava11();
    349         if (noJava7 || noPack200 || openARM || isZero || isJava11) {
     349        if (noJava8 || noPack200 || openARM || isZero || isJava11) {
    350350            String s = "Java version: " + System.getProperty("java.version") +
    351351                       " OS: " + System.getProperty("os.name") + ' ' +
     
    355355            log.logAlways(net.i2p.util.Log.WARN, s);
    356356            System.out.println("Warning: " + s);
    357             if (noJava7) {
    358                 s = "Java 7 is now required, please upgrade";
     357            if (noJava8) {
     358                s = "Java 8 or higher will be required in a future release, please upgrade Java";
    359359                log.logAlways(net.i2p.util.Log.WARN, s);
    360360                System.out.println("Warning: " + s);
Note: See TracChangeset for help on using the changeset viewer.