From 42cd103355be30c3a985719a528bdeefe68d801c Mon Sep 17 00:00:00 2001 From: Vincent Breitmoser Date: Mon, 6 Jul 2015 00:55:34 +0200 Subject: nicer error msg if input data cannot be read --- .../keychain/operations/results/OperationResult.java | 1 + .../java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerify.java | 6 +++--- OpenKeychain/src/main/res/values/strings.xml | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/results/OperationResult.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/results/OperationResult.java index 1ae5aaefb..5ae068b35 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/results/OperationResult.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/results/OperationResult.java @@ -609,6 +609,7 @@ public abstract class OperationResult implements Parcelable { MSG_DC_ERROR_INTEGRITY_MISSING (LogLevel.ERROR, R.string.msg_dc_error_integrity_missing), MSG_DC_ERROR_INVALID_DATA (LogLevel.ERROR, R.string.msg_dc_error_invalid_data), MSG_DC_ERROR_IO (LogLevel.ERROR, R.string.msg_dc_error_io), + MSG_DC_ERROR_INPUT (LogLevel.ERROR, R.string.msg_dc_error_input), MSG_DC_ERROR_NO_DATA (LogLevel.ERROR, R.string.msg_dc_error_no_data), MSG_DC_ERROR_NO_KEY (LogLevel.ERROR, R.string.msg_dc_error_no_key), MSG_DC_ERROR_PGP_EXCEPTION (LogLevel.ERROR, R.string.msg_dc_error_pgp_exception), diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerify.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerify.java index bfe7c3474..7ec447cf6 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerify.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerify.java @@ -96,9 +96,9 @@ public class PgpDecryptVerify extends BaseOperation long inputSize = FileHelper.getFileSize(mContext, input.getInputUri(), 0); inputData = new InputData(inputStream, inputSize); } catch (FileNotFoundException e) { - Log.e(Constants.TAG, "URI could not be opened: " + input.getInputUri(), e); + Log.e(Constants.TAG, "Input URI could not be opened: " + input.getInputUri(), e); OperationLog log = new OperationLog(); - log.add(LogType.MSG_DC_ERROR_IO, 1); + log.add(LogType.MSG_DC_ERROR_INPUT, 1); return new DecryptVerifyResult(DecryptVerifyResult.RESULT_ERROR, log); } } @@ -109,7 +109,7 @@ public class PgpDecryptVerify extends BaseOperation try { outputStream = mContext.getContentResolver().openOutputStream(input.getOutputUri()); } catch (FileNotFoundException e) { - Log.e(Constants.TAG, "URI could not be opened: " + input.getOutputUri(), e); + Log.e(Constants.TAG, "Output URI could not be opened: " + input.getOutputUri(), e); OperationLog log = new OperationLog(); log.add(LogType.MSG_DC_ERROR_IO, 1); return new DecryptVerifyResult(DecryptVerifyResult.RESULT_ERROR, log); diff --git a/OpenKeychain/src/main/res/values/strings.xml b/OpenKeychain/src/main/res/values/strings.xml index 38ff8b5d7..8b224c37c 100644 --- a/OpenKeychain/src/main/res/values/strings.xml +++ b/OpenKeychain/src/main/res/values/strings.xml @@ -1106,6 +1106,7 @@ "Missing integrity check! This can happen because the encrypting application is out of date, or from a downgrade attack." "No valid OpenPGP encrypted or signed data found!" "Encountered IO Exception during operation!" + "Error opening input data stream!" "No encrypted data found in stream!" "No encrypted data with known secret key found in stream!" "Encountered OpenPGP Exception during operation!" -- cgit v1.2.3