summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsnowleo <schneeleo@gmail.com>2012-11-03 00:30:45 +0100
committersnowleo <schneeleo@gmail.com>2012-11-03 00:30:45 +0100
commitaba2540bcd66f5f8103c97192b5d7af09aac9914 (patch)
treec465b700453ee8f6de8980a26bb76bcead2563bd
parentc60beda40f3cd1a971cb76178bd6a73ccb814baa (diff)
downloadEssentials-aba2540bcd66f5f8103c97192b5d7af09aac9914.tar
Essentials-aba2540bcd66f5f8103c97192b5d7af09aac9914.tar.gz
Essentials-aba2540bcd66f5f8103c97192b5d7af09aac9914.tar.lz
Essentials-aba2540bcd66f5f8103c97192b5d7af09aac9914.tar.xz
Essentials-aba2540bcd66f5f8103c97192b5d7af09aac9914.zip
Store filename as key in zippedFiles
-rw-r--r--Essentials/src/net/ess3/storage/StorageObjectMap.java26
1 files changed, 9 insertions, 17 deletions
diff --git a/Essentials/src/net/ess3/storage/StorageObjectMap.java b/Essentials/src/net/ess3/storage/StorageObjectMap.java
index 945beb06a..df5333357 100644
--- a/Essentials/src/net/ess3/storage/StorageObjectMap.java
+++ b/Essentials/src/net/ess3/storage/StorageObjectMap.java
@@ -108,17 +108,9 @@ public abstract class StorageObjectMap<I> extends CacheLoader<String, I> impleme
{
continue;
}
- try
- {
- String shortName = name.substring(0, name.length() - 4);
- addFileToKeys(shortName);
- final String decodedName = Util.decodeFileName(shortName).toLowerCase(Locale.ENGLISH);
- zippedfiles.put(decodedName, file);
- }
- catch (InvalidNameException ex)
- {
- ess.getLogger().log(Level.WARNING, "Invalid filename " + name + " in " + file.getAbsoluteFile(), ex);
- }
+ String shortName = name.substring(0, name.length() - 4);
+ addFileToKeys(shortName);
+ zippedfiles.put(name, file);
}
}
finally
@@ -171,9 +163,10 @@ public abstract class StorageObjectMap<I> extends CacheLoader<String, I> impleme
{
file.delete();
}
- if (zippedfiles.containsKey(lowerCaseName))
+ String sanitizedFilename = Util.sanitizeFileName(name) + ".yml";
+ if (zippedfiles.containsKey(sanitizedFilename))
{
- zippedfiles.put(lowerCaseName, null);
+ zippedfiles.put(sanitizedFilename, null);
}
}
@@ -201,7 +194,7 @@ public abstract class StorageObjectMap<I> extends CacheLoader<String, I> impleme
if (!file.exists())
{
- extractFileFromZip(name, sanitizedFilename, file);
+ extractFileFromZip(sanitizedFilename, file);
}
return file;
}
@@ -212,10 +205,9 @@ public abstract class StorageObjectMap<I> extends CacheLoader<String, I> impleme
loadAllObjectsAsync();
}
- private void extractFileFromZip(final String name, String sanitizedFilename, File file)
+ private void extractFileFromZip(String sanitizedFilename, File file)
{
- String lowerCaseName = name.toLowerCase(Locale.ENGLISH);
- File zipFile = zippedfiles.get(lowerCaseName);
+ File zipFile = zippedfiles.get(sanitizedFilename);
if (zipFile != null)
{
try