public static Uri backupDatabaseInternal(final Folder backupDir) {
        return withChangeLock(() -> {
            closeDb();
            final Uri uri = ContentStorage.get().copy(Uri.fromFile(databasePath()), backupDir, FileNameCreator.forName(DB_FILE_NAME_BACKUP), false);
            init();

            if (uri == null) {
                Log.e("Database could not be copied to " + backupDir.toUserDisplayableString());
                return null;
            }
            Log.i("Database was copied to " + backupDir.toUserDisplayableString());
            return uri;
        });
    }
Attempt to recreate the database if opening has failed

@param dbHelper dbHelper to use to reopen the database
@return null if everything is ok, error message otherwise
main/src/main/java/cgeo/geocaching/storage/DataStore.java