Review Request: JDK-7142921,(fs) Files.probeContentType reports a MIME type of "text/plain" on Ubuntu 11.04

Alan Bateman Alan.Bateman at
Tue Nov 27 04:06:28 PST 2012

On 26/11/2012 19:29, Dan Xu wrote:
>> 1. I don't think AbstractFileTypeDetector should be changed to check 
>> if the file exists and is a directory, maybe you intended this check 
>> to be in the libmagic based FileTypeDetector?
> This is a shortcut for known MIME types for non-exist files and 
> directories for all detectors. GnomeFileTypeDetector and 
> MagicFileTypeDetector can detect correctly for those special cases. 
> But MimeTypesFileTypeDetector may return wrong results. I can move the 
> special check into MimeTypesFileTypeDetector if you think it is a 
> better way.
A FileTypeDetector does not require that the file exists so if you put 
this check in AbstractFileTypeDetector then it essentially disable all 
file type detectors for the case that the file doesn't exist. So I think 
this needs to be moved down, I suspect only the libmagic based 
FileTypeDetector needs to know if the file exists or not.


More information about the nio-dev mailing list