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

Dan Xu dan.xu at
Mon Nov 26 11:14:43 PST 2012

Hi Mike,

Currently, this is the only mime.types file that I find in Mac platform. 
And according to its comment as below, it is also used by other software.

    # This file maps Internet media types to unique file extension(s).
    # Although created for httpd, this file is used by many software systems
    # and has been placed in the public domain for unlimited redisribution.

If this file is not present in some versions of Mac, say Mountain Lion, 
the code can still proceed by loading other mime.types files and then do 
the look-up.

This detector will load mime.types files from four locations. The first 
is the file specified by the jvm system property, mime.types. The second 
is the .mime.types file in the user home directory. The third is the 
platform-dependent MIME types file, like this file in Mac platform. The 
last is the resource file, META-INF/mimetypes.default, in resource.jar.

Therefore, this detector can at least load META-INF/mimetypes.default 
from resource.jar file.


On Mon 26 Nov 2012 10:27:08 AM PST, Mike Duigou wrote:
> I am concerned about relying on the location of the mime.types file on
> mac :
> /private/etc/apache2/mime.types
> The Apache installation included in MacOS X was partially disabled in
> Mountain Lion (10.8) and it seems possible that they will eventually
> remove it or replace it with a different server.
> Mike
> On Nov 25 2012, at 22:40 , Dan Xu wrote:
>> Hi,
>> Please help review the code changes for CR 7142921 and CR 7144997.
>> The webrev is uploaded to,
>> In the fix, I added two new file type detectors, one is
>> MimeTypesFileTypeDetector, and the other is
>> MagicFileTypeDetector.MimeTypesFileTypeDetector is using a file name
>> extension to look up its MIME type by checking mime.types files,
>> which can be used in Linux, Solaris, and Mac.MagicFileTypeDetector is
>> using libmagic to detect a file type in Linux. The library, libmagic,
>> is provided in the same package of file command, which is currently
>> only available in Linux platform.
>> Thanks,
>> -Dan
-------------- next part --------------
An HTML attachment was scrubbed...

More information about the nio-dev mailing list