From 4390757fc365cb3a82f68a283af5a3d4c1f23c10 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Thu, 29 Dec 2011 16:59:49 +0000 Subject: [PATCH] * make sure there's no key collisions when changing the output type --- source/net/sourceforge/filebot/web/CachedResource.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/net/sourceforge/filebot/web/CachedResource.java b/source/net/sourceforge/filebot/web/CachedResource.java index d210c428..1ddbdd22 100644 --- a/source/net/sourceforge/filebot/web/CachedResource.java +++ b/source/net/sourceforge/filebot/web/CachedResource.java @@ -39,7 +39,9 @@ public abstract class CachedResource { 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; // fetch from cache @@ -55,7 +57,7 @@ public abstract class CachedResource { ByteBuffer data = fetchIfModified(new URL(resource), element != null ? lastUpdateTime : 0); if (data != null) { - element = new Element(resource, process(data)); + element = new Element(cacheKey, process(data)); } // update cached data and last-updated time