Fix Opening FB4A Database Plugin

Summary:
The FB4A SQLite database plugin has to be opened 4-5 times before it shows a list of databases. This is because some databases are encrypted and can't be opened. In this case the code throws and exception and we do not catch that, causing the whole load process to crash.

Now catching the exception and returning an empty list.

Reviewed By: jknoxville

Differential Revision: D19463876

fbshipit-source-id: af8c9a70dc2761e62088d90ce89f8d16057e8745
This commit is contained in:
Chun-Ho Ng
2020-01-21 15:55:00 -08:00
committed by Facebook Github Bot
parent 7c03366136
commit c8b9dd949b

View File

@@ -89,6 +89,7 @@ public class SqliteDatabaseDriver extends DatabaseDriver<SqliteDatabaseDescripto
@Override @Override
public List<String> getTableNames(SqliteDatabaseDescriptor databaseDescriptor) { public List<String> getTableNames(SqliteDatabaseDescriptor databaseDescriptor) {
try {
SQLiteDatabase database = SQLiteDatabase database =
sqliteDatabaseConnectionProvider.openDatabase(databaseDescriptor.file); sqliteDatabaseConnectionProvider.openDatabase(databaseDescriptor.file);
try { try {
@@ -108,6 +109,9 @@ public class SqliteDatabaseDriver extends DatabaseDriver<SqliteDatabaseDescripto
} finally { } finally {
database.close(); database.close();
} }
} catch (SQLiteException ex) {
return Collections.emptyList();
}
} }
@Override @Override