3

I'm using this amazing library without any problem for several months now, and it's working great :)

In my last app, I get this error through crashlytics, a lot of it, but I can't reproduce it myself. Does anyone know how it happens, and how I could correct my app to not have this behavior ? I know it's not a library problem, surely one on my app, but I don't understand how it can happen.

Thanks in advance,

java.lang.IllegalStateException: cache is closed at com.nostra13.universalimageloader.cache.disc.impl.ext.DiskLruCache.checkNotClosed(DiskLruCache.java:642) at com.nostra13.universalimageloader.cache.disc.impl.ext.DiskLruCache.get(DiskLruCache.java:413) at com.nostra13.universalimageloader.cache.disc.impl.ext.LruDiscCache.get(LruDiscCache.java:124) at com.nostra13.universalimageloader.core.ImageLoaderEngine$1.run(ImageLoaderEngine.java:72) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) at java.lang.Thread.run(Thread.java:841)

schusss
  • 41
  • 2
  • please share code from where you got this error – koutuk Oct 16 '14 at 12:42
  • that's the problem, I can't reproduce it myself, I just get this stacktrace from crashlytics, and the logs don't show more. I'd like to understand in which case this error is fired in UIL (aside the fact the cache is closed) and how it can be in this state (like wrong termination of activities or fragment) – schusss Oct 16 '14 at 12:58
  • I just had the same error. I opened a screen where an image was supposed to be shown and app crashed – Kaloyan Roussev Apr 15 '15 at 08:42
  • I wouldn't use a library if I were you. Please see http://stackoverflow.com/questions/42227456/use-lru-image-caching-in-conjuction-with-httpresponsecache-for-disk-and-memory-c – iOSAndroidWindowsMobileAppsDev Feb 22 '17 at 07:56

1 Answers1

1

This Exception comes from the checkNotClosed method of DiskLruCache .When the journalWriter is null, such expception will happen.

When the journal size is cut half, journalWriter will close and start rebuild. Any operation during this time will cause such Exception.

The journal is under the cache folder,check if it has changed or deleted.

If you want to clear the DiskCache, it is best to use the framework api to clear the DiskCache.

xiandanin
  • 319
  • 2
  • 11