Ignore:
Timestamp:
2017-05-20T17:11:37+02:00 (7 years ago)
Author:
Don-vip
Message:

see #14821 - workaround for JDK-8180379/JDK-8179014 : prevent JVM crash when opening a file chooser on Windows 10 Creators Update with Windows look & feel + add information about OS build number for Windows & macOS + add utilities to get Java update/build version numbers

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/tools/PlatformHook.java

    r11944 r12217  
    33
    44import java.awt.GraphicsEnvironment;
     5import java.io.BufferedReader;
    56import java.io.File;
    67import java.io.IOException;
     8import java.io.InputStreamReader;
     9import java.nio.charset.StandardCharsets;
    710import java.security.KeyStore;
    811import java.security.KeyStoreException;
     
    140143
    141144    /**
     145     * Returns OS build number.
     146     * @return OS build number.
     147     * @since 12217
     148     */
     149    default String getOSBuildNumber() {
     150        return "";
     151    }
     152
     153    /**
    142154     * Setup system keystore to add JOSM HTTPS certificate (for remote control).
    143155     * @param entryAlias The entry alias to use
     
    172184
    173185    /**
     186     * Executes a native command and returns the first line of standard output.
     187     * @param command array containing the command to call and its arguments.
     188     * @return first stripped line of standard output
     189     * @throws IOException if an I/O error occurs
     190     * @since 12217
     191     */
     192    default String exec(String... command) throws IOException {
     193        Process p = Runtime.getRuntime().exec(command);
     194        try (BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream(), StandardCharsets.UTF_8))) {
     195            return Utils.strip(input.readLine());
     196        }
     197    }
     198
     199    /**
    174200     * Returns the platform-dependent default cache directory.
    175201     * @return the platform-dependent default cache directory
Note: See TracChangeset for help on using the changeset viewer.