Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
DescriptionAleksandar Kostadinov
2015-02-23 11:14:14 UTC
Description of problem:
Trying to get mime type of files with MimetypesFileTypeMap.getDefaultFileTypeMap() [1] results in always returning "application/octet-stream" regardless of file type or extension.
I couldn't find any default mime.types file used by java. So I tried a workaround:
> ln -s /etc/mime.types ~/.mime.types
And it starts to work. I IMO the openjdk package should be modified to take default mime.types from /etc/mime.types and then search in other locations for the file.
[1] http://docs.oracle.com/javaee/5/api/javax/activation/MimetypesFileTypeMap.html
Version-Release number of selected component (if applicable):
java-1.6.0-openjdk-1.6.0.0-1.39.1.9.7.el6.x86_64
How reproducible:
always
Steps to Reproduce:
1. use the following groovy script:
import javax.activation.MimetypesFileTypeMap;
println MimetypesFileTypeMap.getDefaultFileTypeMap().getContentType(args[0])
2. $ groovy mime-type.groovy /tmp/test.html
Actual results:
application/octet-stream
Expected results:
text/html
Additional info:
The same issue does not exist in openjdk 1.8 as shipped with fedora 21. So it must have been fixed somehow in later versions.
Comment 3Andrew John Hughes
2015-07-13 09:57:45 UTC
Confirmed; the bug is present on 6 & 7, but not 8.
$ /usr/lib/jvm/icedtea-6/bin/java RH1195203 ~/projects/httpdocs/redirect.html
application/octet-stream
$ /usr/lib/jvm/icedtea-7/bin/java RH1195203 ~/projects/httpdocs/redirect.html
application/octet-stream
$ /usr/lib/jvm/icedtea-8/bin/java RH1195203 ~/projects/httpdocs/redirect.html
text/html
Comment 5Andrew John Hughes
2016-01-11 17:44:32 UTC
There are files missing from resources.jar in 6 & 7, presumably due to some mistake during the old build process.
$ ls resources-7/META-INF/
MANIFEST.MF services/
$ ls resources-8/META-INF/
mailcap.default MANIFEST.MF mimetypes.default services/
Comment 6Andrew John Hughes
2016-01-12 18:26:49 UTC
There are two parts to fixing this:
1. Fix the build bug which is preventing /META-INF/mimetypes.default and other files being included in resources.jar
2. Make use of the mime.types supplied by mailcap which is more comprehensive and e.g. allows Java to recognise Java source files.
Comment 7Andrew John Hughes
2016-01-21 06:17:00 UTC
Part 2 is done and that resolves this issue. The missing default file should be resolved upstream.
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory, and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.
https://rhn.redhat.com/errata/RHBA-2016-0788.html