Skip to content

Commit d002933

Browse files
author
Brian Burkhalter
committedJan 14, 2025
8347286: (fs) Remove some extensions from java/nio/file/Files/probeContentType/Basic.java
Reviewed-by: alanb, jpai
1 parent d532019 commit d002933

File tree

1 file changed

+2
-13
lines changed
  • test/jdk/java/nio/file/Files/probeContentType

1 file changed

+2
-13
lines changed
 

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

+2-13
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
import java.util.stream.Stream;
4040

4141
import jdk.internal.util.OperatingSystem;
42-
import jdk.internal.util.OSVersion;
4342
import jdk.internal.util.StaticProperty;
4443

4544
/**
@@ -189,18 +188,8 @@ public static void main(String[] args) throws IOException {
189188
exTypes.add(new ExType("xlsx", List.of("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")));
190189
exTypes.add(new ExType("wasm", List.of("application/wasm")));
191190

192-
// extensions with content type that differs on Windows 11+ and
193-
// Windows Server 2025
194-
if (OperatingSystem.isWindows() &&
195-
(StaticProperty.osName().matches("^.*[11|2025]$") ||
196-
new OSVersion(10, 0).compareTo(OSVersion.current()) > 0)) {
197-
System.out.println("Windows 11+ detected: using different types");
198-
exTypes.add(new ExType("bz2", List.of("application/bz2", "application/x-bzip2", "application/x-bzip", "application/x-compressed")));
199-
exTypes.add(new ExType("csv", List.of("text/csv", "application/vnd.ms-excel")));
200-
exTypes.add(new ExType("rar", List.of("application/rar", "application/vnd.rar", "application/x-rar", "application/x-rar-compressed", "application/x-compressed")));
201-
exTypes.add(new ExType("rtf", List.of("application/rtf", "text/rtf", "application/msword")));
202-
exTypes.add(new ExType("7z", List.of("application/x-7z-compressed", "application/x-compressed")));
203-
} else {
191+
// extensions with consistent content type on Unix (but not on Windows)
192+
if (!OperatingSystem.isWindows()) {
204193
exTypes.add(new ExType("bz2", List.of("application/bz2", "application/x-bzip2", "application/x-bzip")));
205194
exTypes.add(new ExType("csv", List.of("text/csv")));
206195
exTypes.add(new ExType("rar", List.of("application/rar", "application/vnd.rar", "application/x-rar", "application/x-rar-compressed")));

0 commit comments

Comments
 (0)
Please sign in to comment.