--- old/src/share/classes/sun/net/www/MimeTable.java 2014-04-07 19:18:34.139376576 +0100 +++ new/src/share/classes/sun/net/www/MimeTable.java 2014-04-07 19:18:33.995376581 +0100 @@ -222,6 +222,9 @@ // to read BOTH the properties format and the mailcap format. protected static String[] mailcapLocations; + private static final String DEFAULT_FILE = + "/sun/net/www/content-types.properties"; + public synchronized void load() { Properties entries = new Properties(); File file = null; @@ -230,33 +233,20 @@ // 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"); + if (userTablePath != null && (file = new File(userTablePath)).exists()) { + is = new BufferedInputStream(new FileInputStream(file)); + } else { + if ((is = MimeTable.class.getResourceAsStream(DEFAULT_FILE)) == null) { + System.err.println("Warning: default mime table not found."); + return; } + is = new BufferedInputStream(is); } - 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"); - } - - is = new BufferedInputStream(new FileInputStream(file)); entries.load(is); is.close(); - } - catch (IOException e) { - System.err.println("Warning: default mime table not found: " + - file.getPath()); + } catch (IOException e) { + System.err.println("Warning: " + file != null ? file.getPath() : "default" + + " mime table not found."); return; } parse(entries); @@ -380,18 +370,6 @@ 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 e = elements();