Review Request: JDK-7142921,(fs) Files.probeContentType reports a MIME type of "text/plain" on Ubuntu 11.04
Alan Bateman
Alan.Bateman at oracle.com
Tue Nov 27 11:39:06 PST 2012
On 27/11/2012 19:27, Dan Xu wrote:
> Thanks for your comments. I have updated MagicFileTypeDetector. As you
> said, libmagic can handle non-existent file. But if we think the MIME
> type of non-existent file is null, MimeTypesFileTypeDetector will
> return wrong type because it only checks the file name extension.
> Shall I add the check to MimeTypesFileTypeDetector?
>
> -Dan
MagicFileTypeDetector can't detect the file type when the file doesn't
exist so returning null is fine. MimeTypesFileTypeDetector is just based
off the file extension so it just needs a file name.
MimeTypesFileTypeDetector shouldn't need to check if the file exists or not.
-Alan
More information about the nio-dev
mailing list