nicer error msg if input data cannot be read
This commit is contained in:
@@ -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_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_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_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_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_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),
|
MSG_DC_ERROR_PGP_EXCEPTION (LogLevel.ERROR, R.string.msg_dc_error_pgp_exception),
|
||||||
|
|||||||
@@ -96,9 +96,9 @@ public class PgpDecryptVerify extends BaseOperation<PgpDecryptVerifyInputParcel>
|
|||||||
long inputSize = FileHelper.getFileSize(mContext, input.getInputUri(), 0);
|
long inputSize = FileHelper.getFileSize(mContext, input.getInputUri(), 0);
|
||||||
inputData = new InputData(inputStream, inputSize);
|
inputData = new InputData(inputStream, inputSize);
|
||||||
} catch (FileNotFoundException e) {
|
} 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();
|
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);
|
return new DecryptVerifyResult(DecryptVerifyResult.RESULT_ERROR, log);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -109,7 +109,7 @@ public class PgpDecryptVerify extends BaseOperation<PgpDecryptVerifyInputParcel>
|
|||||||
try {
|
try {
|
||||||
outputStream = mContext.getContentResolver().openOutputStream(input.getOutputUri());
|
outputStream = mContext.getContentResolver().openOutputStream(input.getOutputUri());
|
||||||
} catch (FileNotFoundException e) {
|
} 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();
|
OperationLog log = new OperationLog();
|
||||||
log.add(LogType.MSG_DC_ERROR_IO, 1);
|
log.add(LogType.MSG_DC_ERROR_IO, 1);
|
||||||
return new DecryptVerifyResult(DecryptVerifyResult.RESULT_ERROR, log);
|
return new DecryptVerifyResult(DecryptVerifyResult.RESULT_ERROR, log);
|
||||||
|
|||||||
@@ -1106,6 +1106,7 @@
|
|||||||
<string name="msg_dc_error_integrity_missing">"Missing integrity check! This can happen because the encrypting application is out of date, or from a downgrade attack."</string>
|
<string name="msg_dc_error_integrity_missing">"Missing integrity check! This can happen because the encrypting application is out of date, or from a downgrade attack."</string>
|
||||||
<string name="msg_dc_error_invalid_data">"No valid OpenPGP encrypted or signed data found!"</string>
|
<string name="msg_dc_error_invalid_data">"No valid OpenPGP encrypted or signed data found!"</string>
|
||||||
<string name="msg_dc_error_io">"Encountered IO Exception during operation!"</string>
|
<string name="msg_dc_error_io">"Encountered IO Exception during operation!"</string>
|
||||||
|
<string name="msg_dc_error_input">"Error opening input data stream!"</string>
|
||||||
<string name="msg_dc_error_no_data">"No encrypted data found in stream!"</string>
|
<string name="msg_dc_error_no_data">"No encrypted data found in stream!"</string>
|
||||||
<string name="msg_dc_error_no_key">"No encrypted data with known secret key found in stream!"</string>
|
<string name="msg_dc_error_no_key">"No encrypted data with known secret key found in stream!"</string>
|
||||||
<string name="msg_dc_error_pgp_exception">"Encountered OpenPGP Exception during operation!"</string>
|
<string name="msg_dc_error_pgp_exception">"Encountered OpenPGP Exception during operation!"</string>
|
||||||
|
|||||||
Reference in New Issue
Block a user