aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java
diff options
context:
space:
mode:
authorVincent Breitmoser <valodim@mugenguild.com>2015-11-09 02:10:13 +0100
committerVincent Breitmoser <valodim@mugenguild.com>2015-11-09 02:10:13 +0100
commit816dce0334e8b8d9da3cb00d31d26033b17040a3 (patch)
tree582d09b05dc212c6ee824fe97471115a39156442 /OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java
parentcf8d61f41e2645d6778e2a043a6219a4ded74ec3 (diff)
downloadopen-keychain-816dce0334e8b8d9da3cb00d31d26033b17040a3.tar.gz
open-keychain-816dce0334e8b8d9da3cb00d31d26033b17040a3.tar.bz2
open-keychain-816dce0334e8b8d9da3cb00d31d26033b17040a3.zip
service: minor code cleanups in key retrieval
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java')
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java17
1 files changed, 5 insertions, 12 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java
index 7dfb3f3f6..d6ef1be85 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java
@@ -701,24 +701,17 @@ public class OpenPgpService extends RemoteService {
Intent result = new Intent();
result.putExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_SUCCESS);
- // return public key if requested by defining a output stream
- if (outputStream != null) {
- boolean requestAsciiArmor =
- data.getBooleanExtra(OpenPgpApi.EXTRA_REQUEST_ASCII_ARMOR, false);
+ boolean requestedKeyData = outputStream != null;
+ if (requestedKeyData) {
+ boolean requestAsciiArmor = data.getBooleanExtra(OpenPgpApi.EXTRA_REQUEST_ASCII_ARMOR, false);
- ArmoredOutputStream arOutStream = null;
try {
if (requestAsciiArmor) {
- arOutStream = new ArmoredOutputStream(outputStream);
- keyRing.encode(arOutStream);
- } else {
- keyRing.encode(outputStream);
+ outputStream = new ArmoredOutputStream(outputStream);
}
+ keyRing.encode(outputStream);
} finally {
try {
- if (arOutStream != null) {
- arOutStream.close();
- }
outputStream.close();
} catch (IOException e) {
Log.e(Constants.TAG, "IOException when closing OutputStream", e);