Changeset 7338 in josm for trunk/src


Ignore:
Timestamp:
2014-07-27T14:21:14+02:00 (5 years ago)
Author:
Don-vip
Message:

see #10230, see #10033 - JDK8 compatibility

File:
1 edited

Legend:

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

    r7337 r7338  
    136136        info.set(X509CertInfo.VALIDITY, interval);
    137137        info.set(X509CertInfo.SERIAL_NUMBER, new CertificateSerialNumber(sn));
    138         info.set(X509CertInfo.SUBJECT, new CertificateSubjectName(owner));
    139         info.set(X509CertInfo.ISSUER, new CertificateIssuerName(owner));
     138
     139        // Change of behaviour in JDK8:
     140        // https://bugs.openjdk.java.net/browse/JDK-8040820
     141        // https://bugs.openjdk.java.net/browse/JDK-7198416
     142        String version = System.getProperty("java.version");
     143        if (version == null || version.matches("^(1\\.)?[7].*")) {
     144            // Java 7 code. To remove with Java 8 migration
     145            info.set(X509CertInfo.SUBJECT, new CertificateSubjectName(owner));
     146            info.set(X509CertInfo.ISSUER, new CertificateIssuerName(owner));
     147        } else {
     148            // Java 8 and later code
     149            info.set(X509CertInfo.SUBJECT, owner);
     150            info.set(X509CertInfo.ISSUER, owner);
     151        }
     152
    140153        info.set(X509CertInfo.KEY, new CertificateX509Key(pair.getPublic()));
    141154        info.set(X509CertInfo.VERSION, new CertificateVersion(CertificateVersion.V3));
     
    203216
    204217                    X509Certificate cert = generateCertificate("CN=localhost, OU=JOSM, O=OpenStreetMap", pair, 1825, "SHA256withRSA",
    205                             "ip:127.0.0.1,dns:localhost,uri:https://127.0.0.1:"+HTTPS_PORT);
     218                            "dns:localhost,ip:127.0.0.1,ip:::1,uri:https://127.0.0.1:"+HTTPS_PORT+",uri:https://::1:"+HTTPS_PORT);
    206219
    207220                    KeyStore ks = KeyStore.getInstance("JKS");
Note: See TracChangeset for help on using the changeset viewer.