Ignore:
Timestamp:
2017-08-31T17:52:05+02:00 (2 years ago)
Author:
Don-vip
Message:

fix #15210 - Fix support of IBM JVM

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/RemoteControl.java

    r8510 r12703  
    1111import org.openstreetmap.josm.data.preferences.BooleanProperty;
    1212import org.openstreetmap.josm.io.remotecontrol.handler.RequestHandler;
     13import org.openstreetmap.josm.tools.Logging;
    1314
    1415/**
     
    4748    public static void start() {
    4849        RemoteControlHttpServer.restartRemoteControlHttpServer();
    49         RemoteControlHttpsServer.restartRemoteControlHttpsServer();
     50        if (supportsHttps()) {
     51            RemoteControlHttpsServer.restartRemoteControlHttpsServer();
     52        }
    5053    }
    5154
     
    5659    public static void stop() {
    5760        RemoteControlHttpServer.stopRemoteControlHttpServer();
    58         RemoteControlHttpsServer.stopRemoteControlHttpsServer();
     61        if (supportsHttps()) {
     62            RemoteControlHttpsServer.stopRemoteControlHttpsServer();
     63        }
     64    }
     65
     66    /**
     67     * Determines if the current JVM support HTTPS remote control.
     68     * @return {@code true} if the JVM provides {@code sun.security.x509} classes
     69     * @since 12703
     70     */
     71    public static boolean supportsHttps() {
     72        try {
     73            return Class.forName("sun.security.x509.GeneralName") != null;
     74        } catch (ClassNotFoundException e) {
     75            Logging.trace(e);
     76            return false;
     77        }
    5978    }
    6079
Note: See TracChangeset for help on using the changeset viewer.