when corruption occurs, not clsing the db is casuing stack overflow

due to a bug in DefaultDatabaseErrorHandler, if the corruption is
so bad that the list of attached databases can't even be retrieved,
then database is not closed in DefaultDatabaseErrorHandler,
this causes the corrupted file to remain on disk.
this causes corruption detection to occur forever until the stack
overflows.

Change-Id: I9896bee220231cbde0b1620ad0a617420424967c
This commit is contained in:
Vasu Nori
2010-06-22 12:22:31 -07:00
parent ef7fa7bc66
commit 5666170c1e

View File

@@ -57,6 +57,10 @@ public final class DefaultDatabaseErrorHandler implements DatabaseErrorHandler {
// before that, get the attached database list first.
try {
attachedDbs = dbObj.getAttachedDbs();
} catch (SQLiteException e) {
/* ignore */
}
try {
dbObj.close();
} catch (SQLiteException e) {
/* ignore */
@@ -83,7 +87,8 @@ public final class DefaultDatabaseErrorHandler implements DatabaseErrorHandler {
try {
new File(fileName).delete();
} catch (Exception e) {
/* ignore */
/* print warning and ignore exception */
Log.w(TAG, "delete failed: " + e.getMessage());
}
}
}