src/java.base/unix/classes/sun/nio/fs/MimeTypesFileTypeDetector.java

Print this page
rev 12244 : 8129632: (fs) Files.probeContentType returns null on Mac OS X
Summary: Append a Uniform Type Identifier-based FileType Detector for Mac OS X
Reviewed-by: XXX

*** 1,7 **** /* ! * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 81,102 **** } while (mimeType == null && !ext.isEmpty()); return mimeType; } - // Get the extension of a file name. - private static String getExtension(String name) { - String ext = ""; - if (name != null && !name.isEmpty()) { - int dot = name.indexOf('.'); - if ((dot >= 0) && (dot < name.length() - 1)) { - ext = name.substring(dot + 1); - } - } - return ext; - } - /** * Parse the mime types file, and store the type-extension mappings into * mimeTypeMap. The mime types file is not loaded until the first probe * to achieve the lazy initialization. It adopts double-checked locking * optimization to reduce the locking overhead. --- 81,90 ----