aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp
diff options
context:
space:
mode:
authorVincent Breitmoser <valodim@mugenguild.com>2014-06-12 01:52:41 +0200
committerVincent Breitmoser <valodim@mugenguild.com>2014-06-12 12:36:58 +0200
commitdea98a4a7e3143acfc01ce1567a9d17c25025b4d (patch)
treecc9eb2df29d71a3449d784acf07b0e7f6b59299c /OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp
parent47368f1d24cb3b4112133a6dddd2793e6787dfdd (diff)
downloadopen-keychain-dea98a4a7e3143acfc01ce1567a9d17c25025b4d.tar.gz
open-keychain-dea98a4a7e3143acfc01ce1567a9d17c25025b4d.tar.bz2
open-keychain-dea98a4a7e3143acfc01ce1567a9d17c25025b4d.zip
import-log: properly distinguish return states
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp')
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpImportExport.java17
1 files changed, 7 insertions, 10 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpImportExport.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpImportExport.java
index bafb086d0..bb45cc7db 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpImportExport.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpImportExport.java
@@ -58,10 +58,6 @@ public class PgpImportExport {
private ProviderHelper mProviderHelper;
- public static final int RETURN_OK = 0;
- public static final int RETURN_BAD = -2;
- public static final int RETURN_UPDATED = 1;
-
public PgpImportExport(Context context, Progressable progressable) {
super();
this.mContext = context;
@@ -118,10 +114,9 @@ public class PgpImportExport {
if (aos != null) {
aos.close();
}
- if (bos != null) {
- bos.close();
- }
+ bos.close();
} catch (IOException e) {
+ // this is just a finally thing, no matter if it doesn't work out.
}
}
}
@@ -153,10 +148,12 @@ public class PgpImportExport {
}
SaveKeyringResult result = mProviderHelper.savePublicKeyRing(key);
- if (result.updated()) {
- newKeys += 1;
- } else {
+ if (!result.success()) {
+ badKeys += 1;
+ } else if (result.updated()) {
oldKeys += 1;
+ } else {
+ newKeys += 1;
}
} catch (PgpGeneralException e) {