From db4d0bd54407d4f6116e51ba0668869f3f790b40 Mon Sep 17 00:00:00 2001 From: Narayan Kamath Date: Mon, 20 Apr 2015 11:47:40 +0100 Subject: Remove support for reading mime types from property files. This support was untested and unused and of very limited utility, given that this class is initialized in the zygote. It also discourages arbitrary changes to the priority order of mappings. Change-Id: I2a7f91d2956627cd59f948561c37678bc45d118d --- luni/src/main/java/libcore/net/MimeUtils.java | 61 --------------------------- 1 file changed, 61 deletions(-) (limited to 'luni/src/main') diff --git a/luni/src/main/java/libcore/net/MimeUtils.java b/luni/src/main/java/libcore/net/MimeUtils.java index 2e72078..e36b3d1 100644 --- a/luni/src/main/java/libcore/net/MimeUtils.java +++ b/luni/src/main/java/libcore/net/MimeUtils.java @@ -16,13 +16,8 @@ package libcore.net; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; import java.util.HashMap; import java.util.Map; -import java.util.Properties; /** * Utilities for dealing with MIME types. @@ -382,7 +377,6 @@ public final class MimeUtils { add("video/x-webex", "wrf"); add("x-conference/x-cooltalk", "ice"); add("x-epoc/x-sisx-app", "sisx"); - applyOverrides(); } private static void add(String mimeType, String extension) { @@ -399,61 +393,6 @@ public final class MimeUtils { } } - private static InputStream getContentTypesPropertiesStream() { - // User override? - String userTable = System.getProperty("content.types.user.table"); - if (userTable != null) { - File f = new File(userTable); - if (f.exists()) { - try { - return new FileInputStream(f); - } catch (IOException ignored) { - } - } - } - - // Standard location? - File f = new File(System.getProperty("java.home"), "lib" + File.separator + "content-types.properties"); - if (f.exists()) { - try { - return new FileInputStream(f); - } catch (IOException ignored) { - } - } - - return null; - } - - /** - * This isn't what the RI does. The RI doesn't have hard-coded defaults, so supplying your - * own "content.types.user.table" means you don't get any of the built-ins, and the built-ins - * come from "$JAVA_HOME/lib/content-types.properties". - */ - private static void applyOverrides() { - // Get the appropriate InputStream to read overrides from, if any. - InputStream stream = getContentTypesPropertiesStream(); - if (stream == null) { - return; - } - - try { - try { - // Read the properties file... - Properties overrides = new Properties(); - overrides.load(stream); - // And translate its mapping to ours... - for (Map.Entry entry : overrides.entrySet()) { - String extension = (String) entry.getKey(); - String mimeType = (String) entry.getValue(); - add(mimeType, extension); - } - } finally { - stream.close(); - } - } catch (IOException ignored) { - } - } - private MimeUtils() { } -- cgit v1.1