summaryrefslogtreecommitdiffstats
path: root/luni/src/main/java
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2014-08-04 15:40:25 -0700
committerElliott Hughes <enh@google.com>2014-08-05 09:33:41 -0700
commitad257e4fe66970482f8ba391982058bada008dd6 (patch)
tree5f35588de91179447a5716fccf06752d6b09c500 /luni/src/main/java
parentc4ec8f34d8464bcadb1bd249915dce18265f5ec9 (diff)
downloadlibcore-ad257e4fe66970482f8ba391982058bada008dd6.zip
libcore-ad257e4fe66970482f8ba391982058bada008dd6.tar.gz
libcore-ad257e4fe66970482f8ba391982058bada008dd6.tar.bz2
Fix MimeUtils to treat ".flac" as "audio/flac".
(cherry-pick of 77926e913a14b9541df38b6175f795f2ca6c5266.) Bug: 15715370 Change-Id: I2d99f070c3debea01621a172d8189951a56736b5
Diffstat (limited to 'luni/src/main/java')
-rw-r--r--luni/src/main/java/libcore/net/MimeUtils.java20
1 files changed, 10 insertions, 10 deletions
diff --git a/luni/src/main/java/libcore/net/MimeUtils.java b/luni/src/main/java/libcore/net/MimeUtils.java
index 994ae90..62ff861 100644
--- a/luni/src/main/java/libcore/net/MimeUtils.java
+++ b/luni/src/main/java/libcore/net/MimeUtils.java
@@ -134,7 +134,6 @@ public final class MimeUtils {
add("application/x-dms", "dms");
add("application/x-doom", "wad");
add("application/x-dvi", "dvi");
- add("application/x-flac", "flac");
add("application/x-font", "pfa");
add("application/x-font", "pfb");
add("application/x-font", "gsf");
@@ -218,6 +217,8 @@ public final class MimeUtils {
add("audio/amr", "amr");
add("audio/amr-wb", "awb");
add("audio/basic", "snd");
+ add("audio/flac", "flac");
+ add("application/x-flac", "flac");
add("audio/imelody", "imy");
add("audio/midi", "mid");
add("audio/midi", "midi");
@@ -379,18 +380,17 @@ public final class MimeUtils {
}
private static void add(String mimeType, String extension) {
- //
- // if we have an existing x --> y mapping, we do not want to
- // override it with another mapping x --> ?
- // this is mostly because of the way the mime-type map below
- // is constructed (if a mime type maps to several extensions
- // the first extension is considered the most popular and is
- // added first; we do not want to overwrite it later).
- //
+ // If we have an existing x -> y mapping, we do not want to
+ // override it with another mapping x -> y2.
+ // If a mime type maps to several extensions
+ // the first extension added is considered the most popular
+ // so we do not want to overwrite it later.
if (!mimeTypeToExtensionMap.containsKey(mimeType)) {
mimeTypeToExtensionMap.put(mimeType, extension);
}
- extensionToMimeTypeMap.put(extension, mimeType);
+ if (!extensionToMimeTypeMap.containsKey(extension)) {
+ extensionToMimeTypeMap.put(extension, mimeType);
+ }
}
private static InputStream getContentTypesPropertiesStream() {