RFR: 8320943: Files/probeContentType/Basic.java fails on latest Windows 11 - content type mismatch

Roger Riggs rriggs at openjdk.org
Fri Dec 1 16:19:06 UTC 2023


On Fri, 1 Dec 2023 01:53:23 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

> If Windows 11+ is detected, add an extra expected MIME type for certain file extensions.

test/jdk/java/nio/file/Files/probeContentType/Basic.java line 58:

> 56:     private static final String EXTRA_RAR = IS_WIN11_PLUS ? "application/x-compressed" : "";
> 57:     private static final String EXTRA_RTF = IS_WIN11_PLUS ? "application/msword" : "";
> 58:     private static final String EXTRA_7Z  = IS_WIN11_PLUS ? "application/x-compressed" : "";

It could be misleading to put a empty string into the expected set.
Could the lists be created depending on the OS?

private static final List<String> BZ2_TYPES = IS_WIN11_PLUS ?
     List.of("application/bz2", "application/x-bzip2", "application/x-bzip", "application/x-compressed") ?
     List.of("application/bz2", "application/x-bzip2", "application/x-bzip");


Does WIndows 11 have a (user) way to change the mapping?
For example, the mapping of .csv to vnd.ms-excel might not be correct if the user selected OpenOffice to handle .csv.  I don't think we have a mechanism to cope with that.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16916#discussion_r1412310067


More information about the nio-dev mailing list