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 11:27:54 PST 2012


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


On 11/27/2012 04:39 AM, Alan Bateman wrote:
> On 27/11/2012 00:53, Dan Xu wrote:
>> Hi,
>>
>> I have added a comment to UnixFileSystemProvider.chain and remove its 
>> "protected" keyword. The new webrev is at, 
>> http://cr.openjdk.java.net/~dxu/7142921/webrev.01/. Thanks!
>>
>> -Dan
> I've looked at the libmagic based FileTypeDetector and it looks good. 
> From the man page, it looks like magic_file will return NULL if it 
> can't open the file, in which case you might not need to test if the 
> file exists. A couple of minor comments:
>
> - the function prototype for magic_open uses "flag" but "flags" would 
> be more correct.
>
> - in initialize0 you can move the second magic_handle == NULL into the 
> previous statement to avoid checking it twice.
>
> - in MagicFileTypeDetector then you shouldn't need to call super 
> explicitly.
>
> I still have on my list to review the mime.types FileTypeDetector, 
> hopefully find time soon. I'm sure others can help review that one too.
>
> -Alan.



More information about the nio-dev mailing list