Permalink
Browse files

[library] Fix containsInDiskCache(). Closes #9

  • Loading branch information...
1 parent cd40907 commit 4af562058a91d8684995995fefea11c00e1398c9 @chrisbanes committed Feb 27, 2013
Showing with 4 additions and 3 deletions.
  1. +4 −3 library/src/uk/co/senab/bitmapcache/BitmapLruCache.java
@@ -177,7 +177,7 @@ public boolean containsInDiskCache(String url) {
checkNotOnMainThread();
try {
- return null != mDiskCache.get(url);
+ return null != mDiskCache.get(transformUrlForDiskCacheKey(url));
} catch (IOException e) {
e.printStackTrace();
}
@@ -321,10 +321,11 @@ public CacheableBitmapDrawable put(final String url, final Bitmap bitmap) {
if (null != mDiskCache) {
checkNotOnMainThread();
- final ReentrantLock lock = getLockForDiskCacheEdit(url);
+ final String key = transformUrlForDiskCacheKey(url);
+ final ReentrantLock lock = getLockForDiskCacheEdit(key);
lock.lock();
try {
- DiskLruCache.Editor editor = mDiskCache.edit(transformUrlForDiskCacheKey(url));
+ DiskLruCache.Editor editor = mDiskCache.edit(key);
Util.saveBitmap(bitmap, editor.newOutputStream(0));
editor.commit();
} catch (IOException e) {

0 comments on commit 4af5620

Please sign in to comment.