Review Request: JDK-7142921,(fs) Files.probeContentType reports a MIME type of "text/plain" on Ubuntu 11.04
Dan Xu
dan.xu at oracle.com
Tue Nov 27 12:14:21 PST 2012
I see. Different detectors hold different principles to detect file
types. Gnome detector and Magic detector will open the file and decide
the type based on the file content. But MimeTypes detector will only
use the file extension.
-Dan
On Tue 27 Nov 2012 11:39:06 AM PST, Alan Bateman wrote:
> 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