RFR: 8320943: Files/probeContentType/Basic.java fails on latest Windows 11 - content type mismatch
Brian Burkhalter
bpb at openjdk.org
Fri Dec 1 17:08:06 UTC 2023
On Fri, 1 Dec 2023 16:56:42 GMT, Alan Bateman <alanb at openjdk.org> wrote:
>> 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.
>
>> Does WIndows 11 have a (user) way to change the mapping?
>
> The mapping comes from the Windows registry so it could be changed but I wouldn't expect that to be common. Part of me wonders if this test should be reduced to a small number of extensions, 30 seems a lot to have to keep up to date with changes like this.
Not related to the above comments, but it looks as if the Windows registry might only be able to handle one MIME type per extension. Also, I wonder how much other software was broken by this mapping change.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16916#discussion_r1412370581
More information about the nio-dev
mailing list