@Override
    public Uri rename(@NonNull final Uri uri, @NonNull final String newName) throws IOException {
        removeFromUriCache(uri); //rename might change Uri. Thus very important to prevent IllegalArgumentExceptions due to nonexisting Uris!
        try {
            return DocumentsContract.renameDocument(getContext().getContentResolver(), uri, newName);
        } catch (IllegalArgumentException iae) {
            //this happens if uri is invalid, e.g. because document or containing folder was deleted externally to c:geo
            Log.d("Exception on trying to rename '" + uri + "' to '" + newName + "' (assuming it was invalid): " + iae);
            return null;
        }
    }
LRU-cache for previously retrieved directory Uri's for Folders
main/src/main/java/cgeo/geocaching/storage/DocumentContentAccessor.java