aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain
diff options
context:
space:
mode:
authorVincent Breitmoser <valodim@mugenguild.com>2014-10-29 22:39:38 +0100
committerVincent Breitmoser <valodim@mugenguild.com>2014-10-29 22:39:38 +0100
commite1285eec7b3fea5ea86bb8cac598e98d6d9f7f14 (patch)
treea22368f12060a504085e19a59cd26ac1ea18de69 /OpenKeychain
parent727783dd00a03e81113f618edf0024da60314be6 (diff)
downloadopen-keychain-e1285eec7b3fea5ea86bb8cac598e98d6d9f7f14.tar.gz
open-keychain-e1285eec7b3fea5ea86bb8cac598e98d6d9f7f14.tar.bz2
open-keychain-e1285eec7b3fea5ea86bb8cac598e98d6d9f7f14.zip
Close stream on key export to avoid partial write (see #986)
Diffstat (limited to 'OpenKeychain')
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/ImportExportOperation.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/ImportExportOperation.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/ImportExportOperation.java
index 6dfac8429..9db9e700f 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/ImportExportOperation.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/ImportExportOperation.java
@@ -494,6 +494,13 @@ public class ImportExportOperation extends BaseOperation {
} catch (IOException e) {
log.add(LogType.MSG_EXPORT_ERROR_IO, 1);
return new ExportResult(ExportResult.RESULT_ERROR, log, okPublic, okSecret);
+ } finally {
+ // Make sure the stream is closed
+ if (outStream != null) try {
+ outStream.close();
+ } catch (Exception e) {
+ Log.e(Constants.TAG, "error closing stream", e);
+ }
}