1
0
mirror of https://github.com/moparisthebest/k-9 synced 2025-02-07 10:40:11 -05:00

remove unnecessary method parameters

This commit is contained in:
Art O Cathain 2014-10-19 18:40:17 +01:00
parent 7945aab8a7
commit 438a350f55

View File

@ -99,7 +99,7 @@ public class LockableDatabase {
} }
try { try {
openOrCreateDataspace(mApplication); openOrCreateDataspace();
} catch (UnavailableStorageException e) { } catch (UnavailableStorageException e) {
Log.e(K9.LOG_TAG, "Unable to open DB on mount", e); Log.e(K9.LOG_TAG, "Unable to open DB on mount", e);
} }
@ -346,7 +346,7 @@ public class LockableDatabase {
mStorageProviderId = newProviderId; mStorageProviderId = newProviderId;
// re-initialize this class with the new Uri // re-initialize this class with the new Uri
openOrCreateDataspace(mApplication); openOrCreateDataspace();
} finally { } finally {
unlockWrite(newProviderId); unlockWrite(newProviderId);
} }
@ -358,7 +358,7 @@ public class LockableDatabase {
public void open() throws UnavailableStorageException { public void open() throws UnavailableStorageException {
lockWrite(); lockWrite();
try { try {
openOrCreateDataspace(mApplication); openOrCreateDataspace();
} finally { } finally {
unlockWrite(); unlockWrite();
} }
@ -367,21 +367,20 @@ public class LockableDatabase {
/** /**
* *
* @param application
* @throws UnavailableStorageException * @throws UnavailableStorageException
*/ */
protected void openOrCreateDataspace(final Application application) throws UnavailableStorageException { private void openOrCreateDataspace() throws UnavailableStorageException {
lockWrite(); lockWrite();
try { try {
final File databaseFile = prepareStorage(mStorageProviderId); final File databaseFile = prepareStorage(mStorageProviderId);
try { try {
doOpenOrCreateDb(application, databaseFile); doOpenOrCreateDb(databaseFile);
} catch (SQLiteException e) { } catch (SQLiteException e) {
// try to gracefully handle DB corruption - see issue 2537 // try to gracefully handle DB corruption - see issue 2537
Log.w(K9.LOG_TAG, "Unable to open DB " + databaseFile + " - removing file and retrying", e); Log.w(K9.LOG_TAG, "Unable to open DB " + databaseFile + " - removing file and retrying", e);
databaseFile.delete(); databaseFile.delete();
doOpenOrCreateDb(application, databaseFile); doOpenOrCreateDb(databaseFile);
} }
if (mDb.getVersion() != mSchemaDefinition.getVersion()) { if (mDb.getVersion() != mSchemaDefinition.getVersion()) {
mSchemaDefinition.doDbUpgrade(mDb); mSchemaDefinition.doDbUpgrade(mDb);
@ -391,10 +390,10 @@ public class LockableDatabase {
} }
} }
private void doOpenOrCreateDb(final Application application, final File databaseFile) { private void doOpenOrCreateDb(final File databaseFile) {
if (StorageManager.InternalStorageProvider.ID.equals(mStorageProviderId)) { if (StorageManager.InternalStorageProvider.ID.equals(mStorageProviderId)) {
// internal storage // internal storage
mDb = application.openOrCreateDatabase(databaseFile.getName(), Context.MODE_PRIVATE, mDb = mApplication.openOrCreateDatabase(databaseFile.getName(), Context.MODE_PRIVATE,
null); null);
} else { } else {
// external storage // external storage
@ -487,7 +486,7 @@ public class LockableDatabase {
} }
if (recreate) { if (recreate) {
openOrCreateDataspace(mApplication); openOrCreateDataspace();
} else { } else {
// stop waiting for mount/unmount events // stop waiting for mount/unmount events
getStorageManager().removeListener(mStorageListener); getStorageManager().removeListener(mStorageListener);