Please use the Apache issue tracking system for new NetBeans issues ( !!
Bug 199642 - FileUtil.getMimeType(fo, acceptableTypes) cannot be overridden
FileUtil.getMimeType(fo, acceptableTypes) cannot be overridden
Product: platform
Classification: Unclassified
Component: Filesystems
Other Linux
: P3 (vote)
: 7.1
Assigned To: Jaroslav Tulach
Depends on:
Blocks: 199641
  Show dependency treegraph
Reported: 2011-06-23 06:50 UTC by Jaroslav Tulach
Modified: 2011-08-10 21:31 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT

FileObject.getMIMEType(String...) (7.15 KB, patch)
2011-07-28 09:11 UTC, Jaroslav Tulach
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jaroslav Tulach 2011-06-23 06:50:01 UTC
While working on bug 199136 it turned out that some clients are calling FileUtil.getMimeType(fo, strings) directly and that this method cannot be overriden in FileSystems.

That is unfortunate as it prevents remotefs from optimizing the performance of mime recognition.
Comment 1 Jaroslav Tulach 2011-07-28 09:11:03 UTC
Created attachment 109661 [details]
Comment 2 Jesse Glick 2011-07-28 12:29:49 UTC
[JG01] Do not introduce an overload of a method differing from the original only in the addition of varargs; it is ambiguous in sources. Use String[] withinMIMETypes instead. With only one known caller, convenience is not a concern anyway. (If it is necessary to support varargs for callers, use getMIMEType(String mimeType1, String... otherMimeTypes).)

[JG02] Should there be a AbstractFileSystem.Info2 with String mimeType(String, String[])?
Comment 3 Jaroslav Tulach 2011-07-28 13:55:53 UTC
Re. JG02 - maybe added when needed. Not necessary for remotefs.
Re. JG01 - what is the problem? I think the addition is binary (of course) as well as source compatible.
Comment 4 Jesse Glick 2011-07-28 21:33:24 UTC
JG01 - with the proposed change, a call fo.getMIMEType() is visually ambiguous between the current zero-arg method, and the equivalent of fo.getMIMEType(new String[0]). It seems the compiler resolves that to the zero-arg method but why risk confusion?
Comment 5 Jaroslav Tulach 2011-07-29 12:36:27 UTC
I don't think we risk a confusion, rather opposite, in current state the behavior is natural:


finds the best mime type possible while


obviously calls the vararg method and checks for the enumerated mimetypes only (usually). Unless more voices disagree, I'd prefer to keep it as proposed.
Comment 6 Jaroslav Tulach 2011-08-04 12:25:33 UTC
I'll integrate tomorrow.
Comment 7 Jaroslav Tulach 2011-08-05 09:47:25 UTC
Comment 8 Quality Engineering 2011-08-10 21:31:30 UTC
Integrated into 'main-golden'
User: Jaroslav Tulach <>
Log: #199642: Adding FileObject.getMIMEType(String...)

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo