diff --git a/jdk/make/CopyFiles.gmk b/jdk/make/CopyFiles.gmk index 9fba2dd04cc..11656c61407 100644 --- a/jdk/make/CopyFiles.gmk +++ b/jdk/make/CopyFiles.gmk @@ -158,15 +158,6 @@ COPY_FILES += $(CURSORS_TARGET_FILES) ########################################################################################## -CONTENT_TYPES_SRC = $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/lib - -$(LIBDIR)/content-types.properties: $(CONTENT_TYPES_SRC)/content-types.properties - $(call install-file) - -COPY_FILES += $(LIBDIR)/content-types.properties - -########################################################################################## - CALENDARS_SRC := $(JDK_TOPDIR)/src/share/lib $(LIBDIR)/calendars.properties: $(CALENDARS_SRC)/calendars.properties diff --git a/jdk/make/CopyIntoClasses.gmk b/jdk/make/CopyIntoClasses.gmk index 6c622e12177..36b0919fa2f 100644 --- a/jdk/make/CopyIntoClasses.gmk +++ b/jdk/make/CopyIntoClasses.gmk @@ -26,7 +26,7 @@ # Copy icu and _dict files used by the text break iterator COPY_PATTERNS := .icu _dict .dat _options .js aliasmap .spp .wav .css \ - .png .gif .xml .dtd .txt oqlhelp.html + .png .gif .xml .dtd .txt oqlhelp.html content-types.properties # These directories should not be copied at all EXCLUDES += \ diff --git a/jdk/make/profile-includes.txt b/jdk/make/profile-includes.txt index f8fbef0c69a..f2ae4c1b31c 100644 --- a/jdk/make/profile-includes.txt +++ b/jdk/make/profile-includes.txt @@ -56,7 +56,6 @@ PROFILE_1_JRE_LIB_FILES := \ $(OPENJDK_TARGET_CPU_LEGACY_LIB)/server/Xusage.txt \ calendars.properties \ classlist \ - content-types.properties \ currency.data \ ext/localedata.jar \ ext/meta-index \ diff --git a/jdk/src/macosx/lib/content-types.properties b/jdk/src/macosx/lib/content-types.properties deleted file mode 100644 index 2126b01188a..00000000000 --- a/jdk/src/macosx/lib/content-types.properties +++ /dev/null @@ -1,276 +0,0 @@ -#sun.net.www MIME content-types table -# -# Property fields: -# -# <description> ::= 'description' '=' <descriptive string> -# <extensions> ::= 'file_extensions' '=' <comma-delimited list, include '.'> -# <image> ::= 'icon' '=' <filename of icon image> -# <action> ::= 'browser' | 'application' | 'save' | 'unknown' -# <application> ::= 'application' '=' <command line template> -# - -# -# The "we don't know anything about this data" type(s). -# Used internally to mark unrecognized types. -# -content/unknown: description=Unknown Content -unknown/unknown: description=Unknown Data Type - -# -# The template we should use for temporary files when launching an application -# to view a document of given type. -# -temp.file.template: /tmp/%s - -# -# The "real" types. -# -application/octet-stream: \ - description=Generic Binary Stream;\ - file_extensions=.saveme,.dump,.hqx,.arc,.o,.a,.bin,.exe,.z,.gz - -application/oda: \ - description=ODA Document;\ - file_extensions=.oda - -application/pdf: \ - description=Adobe PDF Format;\ - file_extensions=.pdf - -application/postscript: \ - description=Postscript File;\ - file_extensions=.eps,.ai,.ps;\ - icon=ps;\ - action=application;\ - application=imagetool %s - -application/x-dvi: \ - description=TeX DVI File;\ - file_extensions=.dvi;\ - action=application;\ - application=xdvi %s - -application/x-hdf: \ - description=Hierarchical Data Format;\ - file_extensions=.hdf;\ - action=save - -application/x-latex: \ - description=LaTeX Source;\ - file_extensions=.latex - -application/x-netcdf: \ - description=Unidata netCDF Data Format;\ - file_extensions=.nc,.cdf;\ - action=save - -application/x-tex: \ - description=TeX Source;\ - file_extensions=.tex - -application/x-texinfo: \ - description=Gnu Texinfo;\ - file_extensions=.texinfo,.texi - -application/x-troff: \ - description=Troff Source;\ - file_extensions=.t,.tr,.roff;\ - action=application;\ - application=xterm -title troff -e sh -c \"nroff %s | col | more -w\" - -application/x-troff-man: \ - description=Troff Manpage Source;\ - file_extensions=.man;\ - action=application;\ - application=xterm -title troff -e sh -c \"nroff -man %s | col | more -w\" - -application/x-troff-me: \ - description=Troff ME Macros;\ - file_extensions=.me;\ - action=application;\ - application=xterm -title troff -e sh -c \"nroff -me %s | col | more -w\" - -application/x-troff-ms: \ - description=Troff MS Macros;\ - file_extensions=.ms;\ - action=application;\ - application=xterm -title troff -e sh -c \"nroff -ms %s | col | more -w\" - -application/x-wais-source: \ - description=Wais Source;\ - file_extensions=.src,.wsrc - -application/zip: \ - description=Zip File;\ - file_extensions=.zip;\ - icon=zip;\ - action=save - -application/x-bcpio: \ - description=Old Binary CPIO Archive;\ - file_extensions=.bcpio; action=save - -application/x-cpio: \ - description=Unix CPIO Archive;\ - file_extensions=.cpio; action=save - -application/x-gtar: \ - description=Gnu Tar Archive;\ - file_extensions=.gtar;\ - icon=tar;\ - action=save - -application/x-shar: \ - description=Shell Archive;\ - file_extensions=.sh,.shar;\ - action=save - -application/x-sv4cpio: \ - description=SVR4 CPIO Archive;\ - file_extensions=.sv4cpio; action=save - -application/x-sv4crc: \ - description=SVR4 CPIO with CRC;\ - file_extensions=.sv4crc; action=save - -application/x-tar: \ - description=Tar Archive;\ - file_extensions=.tar;\ - icon=tar;\ - action=save - -application/x-ustar: \ - description=US Tar Archive;\ - file_extensions=.ustar;\ - action=save - -audio/basic: \ - description=Basic Audio;\ - file_extensions=.snd,.au;\ - icon=audio;\ - action=application;\ - application=audiotool %s - -audio/x-aiff: \ - description=Audio Interchange Format File;\ - file_extensions=.aifc,.aif,.aiff;\ - icon=aiff - -audio/x-wav: \ - description=Wav Audio;\ - file_extensions=.wav;\ - icon=wav - -image/gif: \ - description=GIF Image;\ - file_extensions=.gif;\ - icon=gif;\ - action=browser - -image/ief: \ - description=Image Exchange Format;\ - file_extensions=.ief - -image/jpeg: \ - description=JPEG Image;\ - file_extensions=.jfif,.jfif-tbnl,.jpe,.jpg,.jpeg;\ - icon=jpeg;\ - action=browser;\ - application=imagetool %s - -image/tiff: \ - description=TIFF Image;\ - file_extensions=.tif,.tiff;\ - icon=tiff - -image/vnd.fpx: \ - description=FlashPix Image;\ - file_extensions=.fpx,.fpix - -image/x-cmu-rast: \ - description=CMU Raster Image;\ - file_extensions=.ras - -image/x-portable-anymap: \ - description=PBM Anymap Format;\ - file_extensions=.pnm - -image/x-portable-bitmap: \ - description=PBM Bitmap Format;\ - file_extensions=.pbm - -image/x-portable-graymap: \ - description=PBM Graymap Format;\ - file_extensions=.pgm - -image/x-portable-pixmap: \ - description=PBM Pixmap Format;\ - file_extensions=.ppm - -image/x-rgb: \ - description=RGB Image;\ - file_extensions=.rgb - -image/x-xbitmap: \ - description=X Bitmap Image;\ - file_extensions=.xbm,.xpm - -image/x-xwindowdump: \ - description=X Window Dump Image;\ - file_extensions=.xwd - -image/png: \ - description=PNG Image;\ - file_extensions=.png;\ - icon=png;\ - action=browser - -text/html: \ - description=HTML Document;\ - file_extensions=.htm,.html;\ - icon=html - -text/plain: \ - description=Plain Text;\ - file_extensions=.text,.c,.cc,.c++,.h,.pl,.txt,.java,.el;\ - icon=text;\ - action=browser - -text/tab-separated-values: \ - description=Tab Separated Values Text;\ - file_extensions=.tsv - -text/x-setext: \ - description=Structure Enhanced Text;\ - file_extensions=.etx - -video/mpeg: \ - description=MPEG Video Clip;\ - file_extensions=.mpg,.mpe,.mpeg;\ - icon=mpeg;\ - action=application;\ - application=mpeg_play %s - -video/quicktime: \ - description=QuickTime Video Clip;\ - file_extensions=.mov,.qt - -application/x-troff-msvideo: \ - description=AVI Video;\ - file_extensions=.avi;\ - icon=avi - -video/x-sgi-movie: \ - description=SGI Movie;\ - file_extensions=.movie,.mv - -message/rfc822: \ - description=Internet Email Message;\ - file_extensions=.mime - -application/xml: \ - description=XML document;\ - file_extensions=.xml - - - diff --git a/jdk/src/share/classes/sun/net/www/MimeTable.java b/jdk/src/share/classes/sun/net/www/MimeTable.java index cab244c7615..84d4ef9f7dc 100644 --- a/jdk/src/share/classes/sun/net/www/MimeTable.java +++ b/jdk/src/share/classes/sun/net/www/MimeTable.java @@ -225,39 +225,28 @@ public class MimeTable implements FileNameMap { public synchronized void load() { Properties entries = new Properties(); File file = null; - try { - InputStream is; - // First try to load the user-specific table, if it exists - String userTablePath = - System.getProperty("content.types.user.table"); - if (userTablePath != null) { - file = new File(userTablePath); - if (!file.exists()) { - // No user-table, try to load the default built-in table. - file = new File(System.getProperty("java.home") + - File.separator + - "lib" + - File.separator + - "content-types.properties"); - } - } - else { - // No user table, try to load the default built-in table. - file = new File(System.getProperty("java.home") + - File.separator + - "lib" + - File.separator + - "content-types.properties"); - } + InputStream in; - is = new BufferedInputStream(new FileInputStream(file)); - entries.load(is); - is.close(); + // First try to load the user-specific table, if it exists + String userTablePath = System.getProperty("content.types.user.table"); + if (userTablePath != null && (file = new File(userTablePath)).exists()) { + try { + in = new FileInputStream(file); + } catch (FileNotFoundException e) { + System.err.println("Warning: " + file.getPath() + + " mime table not found."); + return; + } + } else { + in = MimeTable.class.getResourceAsStream("content-types.properties"); + if (in == null) + throw new InternalError("default mime table not found"); } - catch (IOException e) { - System.err.println("Warning: default mime table not found: " + - file.getPath()); - return; + + try (BufferedInputStream bin = new BufferedInputStream(in)) { + entries.load(bin); + } catch (IOException e) { + System.err.println("Warning: " + e.getMessage()); } parse(entries); } @@ -380,18 +369,6 @@ public class MimeTable implements FileNameMap { return MimeEntry.UNKNOWN; } - public synchronized boolean save(String filename) { - if (filename == null) { - filename = System.getProperty("user.home" + - File.separator + - "lib" + - File.separator + - "content-types.properties"); - } - - return saveAsProperties(new File(filename)); - } - public Properties getAsProperties() { Properties properties = new Properties(); Enumeration<MimeEntry> e = elements(); diff --git a/jdk/src/solaris/lib/content-types.properties b/jdk/src/solaris/classes/sun/net/www/content-types.properties similarity index 100% rename from jdk/src/solaris/lib/content-types.properties rename to jdk/src/solaris/classes/sun/net/www/content-types.properties diff --git a/jdk/src/windows/lib/content-types.properties b/jdk/src/windows/classes/sun/net/www/content-types.properties similarity index 100% rename from jdk/src/windows/lib/content-types.properties rename to jdk/src/windows/classes/sun/net/www/content-types.properties