RFR of 8129632: (fs) Files.probeContentType returns null on Mac OS X

Brian Burkhalter brian.burkhalter at oracle.com
Tue Jun 30 15:33:34 UTC 2015

On Jun 30, 2015, at 1:24 AM, Alan Bateman <Alan.Bateman at oracle.com> wrote:

> On 30/06/2015 02:07, Brian Burkhalter wrote:
>> An updated patch is viewable here:
>> http://cr.openjdk.java.net/~bpb/8129632/webrev.01/
> This looks much better.
> Minor nits:
> - getExtension has been moved to AbstractFileTypeDetector, can it be changed to be non-static? Also "Gets the extension" would be nicer as "Returns the extension”.

Will make those changes.

> - In the test then you are using equals("Mac OS X") the Apple recommendation is to use contains("OS X"). This may up during the Mac port a few years ago.

I’ll change it. The reason I used “Mac OS X” is because in the JDK code it is hard coded to that [1]. On OS X the sysname field of struct utsname set by uname(3) actually has value “Darwin.” 


[1] src/java.base/macosx/native/libjava/java_props_macosx.c

void setOSNameAndVersion(java_props_t *sprops) {
    /* Don't rely on JRSCopyOSName because there's no guarantee the value will
     * remain the same, or even if the JRS functions will continue to be part of
     * Mac OS X.  So hardcode os_name, and fill in os_version if we can.
    sprops->os_name = strdup("Mac OS X");
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/nio-dev/attachments/20150630/93f9701d/attachment.html>

More information about the nio-dev mailing list