RFR: 8287237: (fs) Files.probeContentType returns null if filename contains hash mark on Linux

Jaikiran Pai jpai at openjdk.java.net
Fri May 27 12:23:46 UTC 2022


On Thu, 26 May 2022 23:03:05 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

> Modify `sun.net.www.MimeTable.findByFileName(String)` to attempt to find the file extension in the entire file name if it is not found in the portion of the name preceding the optional fragment beginning with a hash (`#`).

src/java.base/share/classes/sun/net/www/MimeTable.java line 196:

> 194: 
> 195:         String ext = "";
> 196:         if (i != -1 && fname.charAt(i) == '.')

Nit - the existing method currently uses a `{` even for single line conditionals. Should we do the same for the new `if` blocks introduced in this PR and enclose them within  `{` `}`?

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

PR: https://git.openjdk.java.net/jdk/pull/8909


More information about the net-dev mailing list