Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6a904bc6 authored by Vasu Nori's avatar Vasu Nori
Browse files

Revert "treat 'can't open database file error' as 'database corruption error'"

This reverts commit c7fe777d.

Change-Id: I9992d404394917537d5c22470efbd970605976ed
parent 6c30cfb0
Loading
Loading
Loading
Loading
+2 −10
Original line number Diff line number Diff line
@@ -991,10 +991,8 @@ public class SQLiteDatabase extends SQLiteClosable {
            }
            return db;
        } catch (SQLiteDatabaseCorruptException e) {
            return handleCorruptedDatabase(db, path, factory, flags, errorHandler);
        } catch (SQLiteCantOpenDatabaseException e) {
            Log.e(TAG, "database file can't be opened. possibly due to database corruption.");
            return handleCorruptedDatabase(db, path, factory, flags, errorHandler);
            db.mErrorHandler.onCorruption(db);
            return SQLiteDatabase.openDatabase(path, factory, flags, errorHandler);
        } catch (SQLiteException e) {
            Log.e(TAG, "Failed to open the database. closing it.", e);
            db.close();
@@ -1002,12 +1000,6 @@ public class SQLiteDatabase extends SQLiteClosable {
        }
    }

    private static SQLiteDatabase handleCorruptedDatabase(SQLiteDatabase db, String path,
            CursorFactory factory, int flags, DatabaseErrorHandler errorHandler) {
        db.mErrorHandler.onCorruption(db);
        return SQLiteDatabase.openDatabase(path, factory, flags, errorHandler);
    }

    /**
     * Equivalent to openDatabase(file.getPath(), factory, CREATE_IF_NECESSARY).
     */