mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-23 17:22:16 -05:00
some coding practice and potential bug fixes
This commit is contained in:
parent
570b7a6d8e
commit
b42f02ba92
@ -1017,7 +1017,10 @@ public class Apg {
|
||||
keyIds.add(c.getInt(0));
|
||||
} while (c.moveToNext());
|
||||
}
|
||||
|
||||
if (c != null) {
|
||||
c.close();
|
||||
}
|
||||
|
||||
return keyIds;
|
||||
}
|
||||
|
@ -10,6 +10,12 @@ public class CachedPassPhrase {
|
||||
this.passPhrase = passPhrase;
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
int hc1 = (int)(this.timestamp & 0xffffffff);
|
||||
int hc2 = (this.passPhrase == null ? 0 : this.passPhrase.hashCode());
|
||||
return (hc1 + hc2) * hc2 + hc1;
|
||||
}
|
||||
|
||||
public boolean equals(Object other) {
|
||||
if (!(other instanceof CachedPassPhrase)) {
|
||||
return false;
|
||||
|
@ -755,6 +755,7 @@ public class EncryptActivity extends BaseActivity {
|
||||
EncryptActivity.this.
|
||||
startActivity(Intent.createChooser(emailIntent,
|
||||
getString(R.string.title_sendEmail)));
|
||||
break;
|
||||
}
|
||||
|
||||
case Id.target.file: {
|
||||
|
@ -200,7 +200,10 @@ public class Database extends SQLiteOpenHelper {
|
||||
}
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
|
||||
if (cursor != null) {
|
||||
cursor.close();
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
@ -427,7 +430,10 @@ public class Database extends SQLiteOpenHelper {
|
||||
rowId = mDb.insert(KeyRings.TABLE_NAME, KeyRings.WHO_ID, values);
|
||||
mStatus = Id.return_value.ok;
|
||||
}
|
||||
|
||||
if (c != null) {
|
||||
c.close();
|
||||
}
|
||||
|
||||
return rowId;
|
||||
}
|
||||
@ -469,7 +475,10 @@ public class Database extends SQLiteOpenHelper {
|
||||
} else {
|
||||
rowId = mDb.insert(UserIds.TABLE_NAME, UserIds.USER_ID, values);
|
||||
}
|
||||
|
||||
if (c != null) {
|
||||
c.close();
|
||||
}
|
||||
|
||||
return rowId;
|
||||
}
|
||||
@ -500,7 +509,10 @@ public class Database extends SQLiteOpenHelper {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (c != null) {
|
||||
c.close();
|
||||
}
|
||||
|
||||
return keyRing;
|
||||
}
|
||||
@ -522,7 +534,10 @@ public class Database extends SQLiteOpenHelper {
|
||||
if (c != null && c.moveToFirst()) {
|
||||
data = c.getBlob(0);
|
||||
}
|
||||
|
||||
if (c != null) {
|
||||
c.close();
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
@ -539,7 +554,10 @@ public class Database extends SQLiteOpenHelper {
|
||||
if (c != null && c.moveToFirst()) {
|
||||
data = c.getBlob(0);
|
||||
}
|
||||
|
||||
if (c != null) {
|
||||
c.close();
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
@ -561,7 +579,10 @@ public class Database extends SQLiteOpenHelper {
|
||||
deleteKey(keyId);
|
||||
} while (c.moveToNext());
|
||||
}
|
||||
|
||||
if (c != null) {
|
||||
c.close();
|
||||
}
|
||||
|
||||
mDb.setTransactionSuccessful();
|
||||
mDb.endTransaction();
|
||||
|
Loading…
Reference in New Issue
Block a user