Compare strings like they should be compared

This commit is contained in:
Markus Doits 2011-01-18 22:24:28 +00:00
parent 945e8bb25b
commit 79cf07f1e2

View File

@ -382,10 +382,10 @@ public class ApgService extends Service {
} catch (Exception e) {
Log.e(TAG, "Exception in encrypt");
String _msg = e.getMessage();
if (_msg == getBaseContext().getString(R.string.error_noSignaturePassPhrase)) {
if (_msg.equals(getBaseContext().getString(R.string.error_noSignaturePassPhrase))) {
pReturn.getStringArrayList(ret.ERRORS.name()).add("Cannot encrypt (" + arg.PRIVATE_KEY_PASSPHRASE.name() + " missing): " + _msg);
pReturn.putInt(ret.ERROR.name(), error.PRIVATE_KEY_PASSPHRASE_MISSING.ordinal());
} else if (_msg == getBaseContext().getString(R.string.error_couldNotExtractPrivateKey)) {
} else if (_msg.equals(getBaseContext().getString(R.string.error_couldNotExtractPrivateKey))) {
pReturn.getStringArrayList(ret.ERRORS.name()).add("Cannot encrypt (" + arg.PRIVATE_KEY_PASSPHRASE.name() + " probably wrong): " + _msg);
pReturn.putInt(ret.ERROR.name(), error.PRIVATE_KEY_PASSPHRASE_WRONG.ordinal());
} else {
@ -436,10 +436,10 @@ public class ApgService extends Service {
} catch (Exception e) {
Log.e(TAG, "Exception in decrypt");
String _msg = e.getMessage();
if (_msg == getBaseContext().getString(R.string.error_noSecretKeyFound)) {
if (_msg.equals(getBaseContext().getString(R.string.error_noSecretKeyFound))) {
pReturn.getStringArrayList(ret.ERRORS.name()).add("Cannot decrypt: " + _msg);
pReturn.putInt(ret.ERROR.name(), error.NO_MATCHING_SECRET_KEY.ordinal());
} else if (_msg == getBaseContext().getString(R.string.error_wrongPassPhrase)) {
} else if (_msg.equals(getBaseContext().getString(R.string.error_wrongPassPhrase))) {
pReturn.getStringArrayList(ret.ERRORS.name()).add("Cannot decrypt (" + arg.PRIVATE_KEY_PASSPHRASE.name() + " wrong/missing): " + _msg);
pReturn.putInt(ret.ERROR.name(), error.PRIVATE_KEY_PASSPHRASE_WRONG.ordinal());
} else {