aboutsummaryrefslogtreecommitdiffstats
path: root/server/src/main/java/com/vaadin/util
diff options
context:
space:
mode:
authorPer-Åke Minborg <minborg@speedment.com>2016-10-28 11:07:23 -0700
committerHenri Sara <hesara@vaadin.com>2016-11-05 04:14:28 +0200
commit3e2ddb469152c430bde5d2c61a9b279a10a8806f (patch)
treebf500ec4b718c9f5bc47a75422e352ed8f69ca22 /server/src/main/java/com/vaadin/util
parent3f30e5bde97007f8cb7023a651c097da726c2bae (diff)
downloadvaadin-framework-3e2ddb469152c430bde5d2c61a9b279a10a8806f.tar.gz
vaadin-framework-3e2ddb469152c430bde5d2c61a9b279a10a8806f.zip
Replace Hashtable
Change-Id: I80b73b653e97904605dc62484a7448f3bfbf7229
Diffstat (limited to 'server/src/main/java/com/vaadin/util')
-rw-r--r--server/src/main/java/com/vaadin/util/FileTypeResolver.java18
1 files changed, 9 insertions, 9 deletions
diff --git a/server/src/main/java/com/vaadin/util/FileTypeResolver.java b/server/src/main/java/com/vaadin/util/FileTypeResolver.java
index 39da3da890..4df2785ce8 100644
--- a/server/src/main/java/com/vaadin/util/FileTypeResolver.java
+++ b/server/src/main/java/com/vaadin/util/FileTypeResolver.java
@@ -19,9 +19,9 @@ package com.vaadin.util;
import java.io.File;
import java.io.Serializable;
import java.util.Collections;
-import java.util.Hashtable;
import java.util.Map;
import java.util.StringTokenizer;
+import java.util.concurrent.ConcurrentHashMap;
import com.vaadin.server.Resource;
import com.vaadin.server.ThemeResource;
@@ -210,12 +210,12 @@ public class FileTypeResolver implements Serializable {
/**
* File extension to MIME type mapping. All extensions are in lower case.
*/
- static private Hashtable<String, String> extToMIMEMap = new Hashtable<>();
+ private static final Map<String, String> EXT_TO_MIME_MAP = new ConcurrentHashMap<>();
/**
* MIME type to Icon mapping.
*/
- static private Hashtable<String, Resource> MIMEToIconMap = new Hashtable<>();
+ private static final Map<String, Resource> MIME_TO_ICON_MAP = new ConcurrentHashMap<>();
static {
@@ -270,7 +270,7 @@ public class FileTypeResolver implements Serializable {
}
// Return type from extension map, if found
- final String type = extToMIMEMap.get(ext.toLowerCase());
+ final String type = EXT_TO_MIME_MAP.get(ext.toLowerCase());
if (type != null) {
return type;
}
@@ -294,7 +294,7 @@ public class FileTypeResolver implements Serializable {
}
private static Resource getIconByMimeType(String mimeType) {
- final Resource icon = MIMEToIconMap.get(mimeType);
+ final Resource icon = MIME_TO_ICON_MAP.get(mimeType);
if (icon != null) {
return icon;
}
@@ -358,7 +358,7 @@ public class FileTypeResolver implements Serializable {
* the new mime-type for <code>extension</code>.
*/
public static void addExtension(String extension, String MIMEType) {
- extToMIMEMap.put(extension.toLowerCase(), MIMEType);
+ EXT_TO_MIME_MAP.put(extension.toLowerCase(), MIMEType);
}
/**
@@ -371,7 +371,7 @@ public class FileTypeResolver implements Serializable {
* the new icon to be associated with <code>MIMEType</code>.
*/
public static void addIcon(String MIMEType, Resource icon) {
- MIMEToIconMap.put(MIMEType, icon);
+ MIME_TO_ICON_MAP.put(MIMEType, icon);
}
/**
@@ -381,7 +381,7 @@ public class FileTypeResolver implements Serializable {
* mime-type mapping
*/
public static Map<String, String> getExtensionToMIMETypeMapping() {
- return Collections.unmodifiableMap(extToMIMEMap);
+ return Collections.unmodifiableMap(EXT_TO_MIME_MAP);
}
/**
@@ -390,7 +390,7 @@ public class FileTypeResolver implements Serializable {
* @return unmodifiable map containing the current mime-type to icon mapping
*/
public static Map<String, Resource> getMIMETypeToIconMapping() {
- return Collections.unmodifiableMap(MIMEToIconMap);
+ return Collections.unmodifiableMap(MIME_TO_ICON_MAP);
}
private FileTypeResolver() {