1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-11-16 14:25:02 -05:00

* make sure there's no key collisions when changing the output type

This commit is contained in:
Reinhard Pointner 2011-12-29 16:59:49 +00:00
parent 50adfcc300
commit 4390757fc3

View File

@ -39,7 +39,9 @@ public abstract class CachedResource<T extends Serializable> {
public synchronized T get() throws IOException { public synchronized T get() throws IOException {
Element element = cache.get(resource); String cacheKey = type.getName() + ":" + resource.toString();
Element element = cache.get(cacheKey);
long lastUpdateTime = (element != null) ? element.getLatestOfCreationAndUpdateTime() : 0; long lastUpdateTime = (element != null) ? element.getLatestOfCreationAndUpdateTime() : 0;
// fetch from cache // fetch from cache
@ -55,7 +57,7 @@ public abstract class CachedResource<T extends Serializable> {
ByteBuffer data = fetchIfModified(new URL(resource), element != null ? lastUpdateTime : 0); ByteBuffer data = fetchIfModified(new URL(resource), element != null ? lastUpdateTime : 0);
if (data != null) { if (data != null) {
element = new Element(resource, process(data)); element = new Element(cacheKey, process(data));
} }
// update cached data and last-updated time // update cached data and last-updated time