DiskLruCache icon indicating copy to clipboard operation
DiskLruCache copied to clipboard

Editor edit(String key, long expectedSequenceNumber) should throw ConcurrentModificationException

Open wischweh opened this issue 12 years ago • 3 comments

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,

wischweh avatar Jul 13 '12 11:07 wischweh

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

DHuckaby avatar Jul 13 '12 12:07 DHuckaby

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.

lexs avatar Jul 20 '12 17:07 lexs

It should NOT throw ANYTHING, it should successfully return another Editor and allow concurrent modification of cache.

virl avatar May 02 '15 15:05 virl