author | dxu |
Tue, 04 Dec 2012 14:07:30 +0000 | |
changeset 14702 | 111342b28e67 |
parent 14342 | 8435a30053c1 |
permissions | -rw-r--r-- |
13360
b62b5e86f92a
7130915: File.equals does not give expected results when path contains Non-English characters on Mac OS X
sherman
parents:
diff
changeset
|
1 |
/* |
14342
8435a30053c1
7197491: update copyright year to match last edit in jdk8 jdk repository
alanb
parents:
13360
diff
changeset
|
2 |
* Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. |
13360
b62b5e86f92a
7130915: File.equals does not give expected results when path contains Non-English characters on Mac OS X
sherman
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
b62b5e86f92a
7130915: File.equals does not give expected results when path contains Non-English characters on Mac OS X
sherman
parents:
diff
changeset
|
4 |
* |
b62b5e86f92a
7130915: File.equals does not give expected results when path contains Non-English characters on Mac OS X
sherman
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
b62b5e86f92a
7130915: File.equals does not give expected results when path contains Non-English characters on Mac OS X
sherman
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
b62b5e86f92a
7130915: File.equals does not give expected results when path contains Non-English characters on Mac OS X
sherman
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. Oracle designates this |
b62b5e86f92a
7130915: File.equals does not give expected results when path contains Non-English characters on Mac OS X
sherman
parents:
diff
changeset
|
8 |
* particular file as subject to the "Classpath" exception as provided |
b62b5e86f92a
7130915: File.equals does not give expected results when path contains Non-English characters on Mac OS X
sherman
parents:
diff
changeset
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
b62b5e86f92a
7130915: File.equals does not give expected results when path contains Non-English characters on Mac OS X
sherman
parents:
diff
changeset
|
10 |
* |
b62b5e86f92a
7130915: File.equals does not give expected results when path contains Non-English characters on Mac OS X
sherman
parents:
diff
changeset
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
b62b5e86f92a
7130915: File.equals does not give expected results when path contains Non-English characters on Mac OS X
sherman
parents:
diff
changeset
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
b62b5e86f92a
7130915: File.equals does not give expected results when path contains Non-English characters on Mac OS X
sherman
parents:
diff
changeset
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
b62b5e86f92a
7130915: File.equals does not give expected results when path contains Non-English characters on Mac OS X
sherman
parents:
diff
changeset
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
b62b5e86f92a
7130915: File.equals does not give expected results when path contains Non-English characters on Mac OS X
sherman
parents:
diff
changeset
|
15 |
* accompanied this code). |
b62b5e86f92a
7130915: File.equals does not give expected results when path contains Non-English characters on Mac OS X
sherman
parents:
diff
changeset
|
16 |
* |
b62b5e86f92a
7130915: File.equals does not give expected results when path contains Non-English characters on Mac OS X
sherman
parents:
diff
changeset
|
17 |
* You should have received a copy of the GNU General Public License version |
b62b5e86f92a
7130915: File.equals does not give expected results when path contains Non-English characters on Mac OS X
sherman
parents:
diff
changeset
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
b62b5e86f92a
7130915: File.equals does not give expected results when path contains Non-English characters on Mac OS X
sherman
parents:
diff
changeset
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
b62b5e86f92a
7130915: File.equals does not give expected results when path contains Non-English characters on Mac OS X
sherman
parents:
diff
changeset
|
20 |
* |
b62b5e86f92a
7130915: File.equals does not give expected results when path contains Non-English characters on Mac OS X
sherman
parents:
diff
changeset
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
b62b5e86f92a
7130915: File.equals does not give expected results when path contains Non-English characters on Mac OS X
sherman
parents:
diff
changeset
|
22 |
* or visit www.oracle.com if you need additional information or have any |
b62b5e86f92a
7130915: File.equals does not give expected results when path contains Non-English characters on Mac OS X
sherman
parents:
diff
changeset
|
23 |
* questions. |
b62b5e86f92a
7130915: File.equals does not give expected results when path contains Non-English characters on Mac OS X
sherman
parents:
diff
changeset
|
24 |
*/ |
b62b5e86f92a
7130915: File.equals does not give expected results when path contains Non-English characters on Mac OS X
sherman
parents:
diff
changeset
|
25 |
|
b62b5e86f92a
7130915: File.equals does not give expected results when path contains Non-English characters on Mac OS X
sherman
parents:
diff
changeset
|
26 |
package sun.nio.fs; |
b62b5e86f92a
7130915: File.equals does not give expected results when path contains Non-English characters on Mac OS X
sherman
parents:
diff
changeset
|
27 |
|
14702
111342b28e67
7142921: (fs) Files.probeContentType reports a MIME type of "text/plain" on Ubuntu 11.04
dxu
parents:
14342
diff
changeset
|
28 |
import java.nio.file.Path; |
111342b28e67
7142921: (fs) Files.probeContentType reports a MIME type of "text/plain" on Ubuntu 11.04
dxu
parents:
14342
diff
changeset
|
29 |
import java.nio.file.Paths; |
111342b28e67
7142921: (fs) Files.probeContentType reports a MIME type of "text/plain" on Ubuntu 11.04
dxu
parents:
14342
diff
changeset
|
30 |
import java.nio.file.spi.FileTypeDetector; |
111342b28e67
7142921: (fs) Files.probeContentType reports a MIME type of "text/plain" on Ubuntu 11.04
dxu
parents:
14342
diff
changeset
|
31 |
import java.security.AccessController; |
111342b28e67
7142921: (fs) Files.probeContentType reports a MIME type of "text/plain" on Ubuntu 11.04
dxu
parents:
14342
diff
changeset
|
32 |
import sun.security.action.GetPropertyAction; |
13360
b62b5e86f92a
7130915: File.equals does not give expected results when path contains Non-English characters on Mac OS X
sherman
parents:
diff
changeset
|
33 |
|
b62b5e86f92a
7130915: File.equals does not give expected results when path contains Non-English characters on Mac OS X
sherman
parents:
diff
changeset
|
34 |
/** |
b62b5e86f92a
7130915: File.equals does not give expected results when path contains Non-English characters on Mac OS X
sherman
parents:
diff
changeset
|
35 |
* MacOSX implementation of FileSystemProvider |
b62b5e86f92a
7130915: File.equals does not give expected results when path contains Non-English characters on Mac OS X
sherman
parents:
diff
changeset
|
36 |
*/ |
b62b5e86f92a
7130915: File.equals does not give expected results when path contains Non-English characters on Mac OS X
sherman
parents:
diff
changeset
|
37 |
|
b62b5e86f92a
7130915: File.equals does not give expected results when path contains Non-English characters on Mac OS X
sherman
parents:
diff
changeset
|
38 |
public class MacOSXFileSystemProvider extends BsdFileSystemProvider { |
b62b5e86f92a
7130915: File.equals does not give expected results when path contains Non-English characters on Mac OS X
sherman
parents:
diff
changeset
|
39 |
public MacOSXFileSystemProvider() { |
b62b5e86f92a
7130915: File.equals does not give expected results when path contains Non-English characters on Mac OS X
sherman
parents:
diff
changeset
|
40 |
super(); |
b62b5e86f92a
7130915: File.equals does not give expected results when path contains Non-English characters on Mac OS X
sherman
parents:
diff
changeset
|
41 |
} |
b62b5e86f92a
7130915: File.equals does not give expected results when path contains Non-English characters on Mac OS X
sherman
parents:
diff
changeset
|
42 |
|
b62b5e86f92a
7130915: File.equals does not give expected results when path contains Non-English characters on Mac OS X
sherman
parents:
diff
changeset
|
43 |
@Override |
b62b5e86f92a
7130915: File.equals does not give expected results when path contains Non-English characters on Mac OS X
sherman
parents:
diff
changeset
|
44 |
MacOSXFileSystem newFileSystem(String dir) { |
b62b5e86f92a
7130915: File.equals does not give expected results when path contains Non-English characters on Mac OS X
sherman
parents:
diff
changeset
|
45 |
return new MacOSXFileSystem(this, dir); |
b62b5e86f92a
7130915: File.equals does not give expected results when path contains Non-English characters on Mac OS X
sherman
parents:
diff
changeset
|
46 |
} |
14702
111342b28e67
7142921: (fs) Files.probeContentType reports a MIME type of "text/plain" on Ubuntu 11.04
dxu
parents:
14342
diff
changeset
|
47 |
|
111342b28e67
7142921: (fs) Files.probeContentType reports a MIME type of "text/plain" on Ubuntu 11.04
dxu
parents:
14342
diff
changeset
|
48 |
@Override |
111342b28e67
7142921: (fs) Files.probeContentType reports a MIME type of "text/plain" on Ubuntu 11.04
dxu
parents:
14342
diff
changeset
|
49 |
FileTypeDetector getFileTypeDetector() { |
111342b28e67
7142921: (fs) Files.probeContentType reports a MIME type of "text/plain" on Ubuntu 11.04
dxu
parents:
14342
diff
changeset
|
50 |
Path userMimeTypes = Paths.get(AccessController.doPrivileged( |
111342b28e67
7142921: (fs) Files.probeContentType reports a MIME type of "text/plain" on Ubuntu 11.04
dxu
parents:
14342
diff
changeset
|
51 |
new GetPropertyAction("user.home")), ".mime.types"); |
111342b28e67
7142921: (fs) Files.probeContentType reports a MIME type of "text/plain" on Ubuntu 11.04
dxu
parents:
14342
diff
changeset
|
52 |
return new MimeTypesFileTypeDetector(userMimeTypes); |
111342b28e67
7142921: (fs) Files.probeContentType reports a MIME type of "text/plain" on Ubuntu 11.04
dxu
parents:
14342
diff
changeset
|
53 |
} |
13360
b62b5e86f92a
7130915: File.equals does not give expected results when path contains Non-English characters on Mac OS X
sherman
parents:
diff
changeset
|
54 |
} |