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.
Bug 1195203 - openjdk 6: MimetypesFileTypeMap no default mime.types
Summary: openjdk 6: MimetypesFileTypeMap no default mime.types
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: java-1.6.0-openjdk
Version: 6.1
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Andrew John Hughes
QA Contact: Lukáš Zachar
URL:
Whiteboard:
Depends On:
Blocks: 1271375
TreeView+ depends on / blocked
 
Reported: 2015-02-23 11:14 UTC by Aleksandar Kostadinov
Modified: 2016-05-10 20:29 UTC (History)
4 users (show)

Fixed In Version: java-1.6.0-openjdk-1.6.0.38-1.13.10.3.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-05-10 20:29:54 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Icedtea Bugzilla 2800 0 None None None 2016-01-21 06:22:30 UTC
Red Hat Product Errata RHBA-2016:0788 0 normal SHIPPED_LIVE java-1.6.0-openjdk bug fix update 2016-05-10 22:36:41 UTC

Description Aleksandar 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 3 Andrew 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 5 Andrew 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 6 Andrew 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 7 Andrew 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.

Comment 12 errata-xmlrpc 2016-05-10 20:29:54 UTC
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


Note You need to log in before you can comment on or make changes to this bug.