DiskLruCache
DiskLruCache copied to clipboard
Editor edit(String key, long expectedSequenceNumber) should throw ConcurrentModificationException
If called while another editor is in use edit will return null. I had a hard time debugging this. Throwing a ConcurrentModificationException or something similar would be better.
see DiskLruCache Line 512,
Clients call edit() to create or update the values of an entry. An entry may have only one editor at one time; if a value is not available to be edited then edit() will return null.
ref: https://github.com/JakeWharton/DiskLruCache/blob/master/src/main/java/com/jakewharton/DiskLruCache.java#L68
It should definitely not throw a ConcurrentModificationException as that's a RuntimeException. I think it would be valid to throw IOException (as we can't open the file) and then state that it never returns null.
It should NOT throw ANYTHING, it should successfully return another Editor and allow concurrent modification of cache.