Loading core/java/android/database/sqlite/SQLiteDatabase.java +10 −2 Original line number Original line Diff line number Diff line Loading @@ -991,8 +991,10 @@ public class SQLiteDatabase extends SQLiteClosable { } } return db; return db; } catch (SQLiteDatabaseCorruptException e) { } catch (SQLiteDatabaseCorruptException e) { db.mErrorHandler.onCorruption(db); return handleCorruptedDatabase(db, path, factory, flags, errorHandler); return SQLiteDatabase.openDatabase(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); } catch (SQLiteException e) { } catch (SQLiteException e) { Log.e(TAG, "Failed to open the database. closing it.", e); Log.e(TAG, "Failed to open the database. closing it.", e); db.close(); db.close(); Loading @@ -1000,6 +1002,12 @@ 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). * Equivalent to openDatabase(file.getPath(), factory, CREATE_IF_NECESSARY). */ */ Loading Loading
core/java/android/database/sqlite/SQLiteDatabase.java +10 −2 Original line number Original line Diff line number Diff line Loading @@ -991,8 +991,10 @@ public class SQLiteDatabase extends SQLiteClosable { } } return db; return db; } catch (SQLiteDatabaseCorruptException e) { } catch (SQLiteDatabaseCorruptException e) { db.mErrorHandler.onCorruption(db); return handleCorruptedDatabase(db, path, factory, flags, errorHandler); return SQLiteDatabase.openDatabase(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); } catch (SQLiteException e) { } catch (SQLiteException e) { Log.e(TAG, "Failed to open the database. closing it.", e); Log.e(TAG, "Failed to open the database. closing it.", e); db.close(); db.close(); Loading @@ -1000,6 +1002,12 @@ 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). * Equivalent to openDatabase(file.getPath(), factory, CREATE_IF_NECESSARY). */ */ Loading