Skip to content

Commit 5d46630

Browse files
author
duke
committed
Backport 2e00816ac30373df28a29dc938f7ce5489a3edfc
1 parent f90566a commit 5d46630

File tree

1 file changed

+6
-4
lines changed
  • test/jdk/java/nio/file/Files/probeContentType

1 file changed

+6
-4
lines changed

test/jdk/java/nio/file/Files/probeContentType/Basic.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2008, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -40,6 +40,7 @@
4040

4141
import jdk.internal.util.OperatingSystem;
4242
import jdk.internal.util.OSVersion;
43+
import jdk.internal.util.StaticProperty;
4344

4445
/**
4546
* Uses Files.probeContentType to probe html file, custom file type, and minimal
@@ -83,7 +84,7 @@ private static int checkContentTypes(String expected, String actual) {
8384
if (!expected.equals(actual)) {
8485
if (!OperatingSystem.isWindows()) {
8586
Path userMimeTypes =
86-
Path.of(System.getProperty("user.home"), ".mime.types");
87+
Path.of(StaticProperty.userHome(), ".mime.types");
8788
checkMimeTypesFile(userMimeTypes);
8889

8990
Path etcMimeTypes = Path.of("/etc/mime.types");
@@ -188,9 +189,10 @@ public static void main(String[] args) throws IOException {
188189
exTypes.add(new ExType("xlsx", List.of("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")));
189190
exTypes.add(new ExType("wasm", List.of("application/wasm")));
190191

191-
// extensions with content type that differs on Windows 11+
192+
// extensions with content type that differs on Windows 11+ and
193+
// Windows Server 2025
192194
if (OperatingSystem.isWindows() &&
193-
(System.getProperty("os.name").endsWith("11") ||
195+
(StaticProperty.osName().matches("^.*[11|2025]$") ||
194196
new OSVersion(10, 0).compareTo(OSVersion.current()) > 0)) {
195197
System.out.println("Windows 11+ detected: using different types");
196198
exTypes.add(new ExType("bz2", List.of("application/bz2", "application/x-bzip2", "application/x-bzip", "application/x-compressed")));

0 commit comments

Comments
 (0)