RFR: JDK-8307807 Replace use of System.getProperty("os.name") with PlatformUtil calls

Nir Lisker nlisker at openjdk.org
Thu May 11 00:48:50 UTC 2023


On Wed, 10 May 2023 18:47:16 GMT, Carl Döbbelin <duke at openjdk.org> wrote:

> Replaced querying of `System.getProperty("os.name")` to check for OS with the use of the methods provided by `PlatformUtils`

Found an occurrences:
* `com.sun.javafx.application.LauncherImpl` line 386.
* `com.sun.media.jfxmediaimpl.HostUtils` seems to be recreating the `PlatformUtil` API, can probably be replaced. `"os.arch"` could be moved to `PlatformUtil` probably.
* `com.sun.webkit.network.URLLoader` line 244.
* `ClipboardExtImageTest` line 59.
* `BigGlyphIDTest` line 39.
* `INVISIBLE_GLYPH_IDTest` line 39.
* There are occurrences in the apps folder in ensemble. 

Creating an enum for the OS is not a bad idea by the way.

modules/javafx.media/src/main/java/com/sun/media/jfxmedia/locator/Locator.java line 363:

> 361:             // On non-Windows systems, replace "/~/" with home directory path + "/".
> 362:             if (!PlatformUtil.isWindows()
> 363:                     && protocol.equals("file")) {

Can be on the same line now.

-------------

PR Review: https://git.openjdk.org/jfx/pull/1132#pullrequestreview-1421506932
PR Review Comment: https://git.openjdk.org/jfx/pull/1132#discussion_r1190487281


More information about the openjfx-dev mailing list