JDK 9 RFR of 8146215: (fs) java/nio/file/Files/probeContentType/Basic.java failed frequently on Solaris-sparc with Unexpected type: text/plain
Alan Bateman
Alan.Bateman at oracle.com
Sat Jul 30 09:31:45 UTC 2016
On 29/07/2016 22:51, Brian Burkhalter wrote:
>
> An updated version of the patch is here:
>
> http://cr.openjdk.java.net/~bpb/8146215/webrev.01/
> <http://cr.openjdk.java.net/%7Ebpb/8146215/webrev.01/>
>
> Thanks,
>
> Brian
The synchronization doesn't look right in FileNameMapFileTypeDetector.
As fileNameMap is static then synchronized (this) { ... } doesn't do
what you intend. It's not an issue if URLConnection.getFileNameMap() is
invoked more than once so I think you can reduce this down to:
FileNameMap map = fileNameMap;
if (map == null) {
fileNameMap = map = URLConnection.getFileNameMap();
}
return map.getContentTypeFor(...);
Alternatively just call URLConnection.getFileNameMap() each time.
As regards ordering what what you have it okay. I assume it will be rare
to set the property content.types.user.table and so the JDK's
content-types.properties will be a fallback.
-Alan
More information about the nio-dev
mailing list