diff options
author | Markus Doits <markus.doits@gmail.com> | 2011-01-20 20:00:28 +0000 |
---|---|---|
committer | Markus Doits <markus.doits@gmail.com> | 2011-01-20 20:00:28 +0000 |
commit | c9f6f56827ce7b368a009c153d1f9995651f6522 (patch) | |
tree | 7d2c275f599c29e3acd9901ee6c0a01faf6d4980 /src/org/thialfihar/android/apg/ApgService.java | |
parent | 392969629c9fb4953a0a257e866d8538515faa50 (diff) | |
download | open-keychain-c9f6f56827ce7b368a009c153d1f9995651f6522.tar.gz open-keychain-c9f6f56827ce7b368a009c153d1f9995651f6522.tar.bz2 open-keychain-c9f6f56827ce7b368a009c153d1f9995651f6522.zip |
Work on errors and documentation - once more
Diffstat (limited to 'src/org/thialfihar/android/apg/ApgService.java')
-rw-r--r-- | src/org/thialfihar/android/apg/ApgService.java | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/org/thialfihar/android/apg/ApgService.java b/src/org/thialfihar/android/apg/ApgService.java index fc6742445..c4a348cb4 100644 --- a/src/org/thialfihar/android/apg/ApgService.java +++ b/src/org/thialfihar/android/apg/ApgService.java @@ -38,7 +38,11 @@ public class ApgService extends Service { APG_FAILURE, NO_MATCHING_SECRET_KEY, PRIVATE_KEY_PASSPHRASE_WRONG, - PRIVATE_KEY_PASSPHRASE_MISSING + PRIVATE_KEY_PASSPHRASE_MISSING; + + public int shifted_ordinal() { + return ordinal() + 100; + } } /** all arguments that can be passed by calling application */ @@ -355,7 +359,7 @@ public class ApgService extends Service { /* return if errors happened */ if (pReturn.getStringArrayList(ret.ERRORS.name()).size() != 0) { - pReturn.putInt(ret.ERROR.name(), error.ARGUMENTS_MISSING.ordinal()); + pReturn.putInt(ret.ERROR.name(), error.ARGUMENTS_MISSING.shifted_ordinal()); return false; } Log.v(TAG, "error return"); @@ -401,13 +405,13 @@ public class ApgService extends Service { String _msg = e.getMessage(); 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()); + pReturn.putInt(ret.ERROR.name(), error.PRIVATE_KEY_PASSPHRASE_MISSING.shifted_ordinal()); } 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()); + pReturn.putInt(ret.ERROR.name(), error.PRIVATE_KEY_PASSPHRASE_WRONG.shifted_ordinal()); } else { pReturn.getStringArrayList(ret.ERRORS.name()).add("Internal failure (" + e.getClass() + ") in APG when encrypting: " + e.getMessage()); - pReturn.putInt(ret.ERROR.name(), error.APG_FAILURE.ordinal()); + pReturn.putInt(ret.ERROR.name(), error.APG_FAILURE.shifted_ordinal()); } return false; } @@ -455,13 +459,13 @@ public class ApgService extends Service { String _msg = e.getMessage(); 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()); + pReturn.putInt(ret.ERROR.name(), error.NO_MATCHING_SECRET_KEY.shifted_ordinal()); } 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()); + pReturn.putInt(ret.ERROR.name(), error.PRIVATE_KEY_PASSPHRASE_WRONG.shifted_ordinal()); } else { pReturn.getStringArrayList(ret.ERRORS.name()).add("Internal failure (" + e.getClass() + ") in APG when decrypting: " + _msg); - pReturn.putInt(ret.ERROR.name(), error.APG_FAILURE.ordinal()); + pReturn.putInt(ret.ERROR.name(), error.APG_FAILURE.shifted_ordinal()); } return false; } |