From 01038d6a2640ce3c6327389798077bb4b35a6c9b Mon Sep 17 00:00:00 2001 From: Vincent Breitmoser Date: Wed, 16 Sep 2015 20:44:32 +0200 Subject: mime: add logging messages --- .../keychain/operations/InputDataOperation.java | 35 +++++++++++----------- .../operations/results/OperationResult.java | 2 +- 2 files changed, 18 insertions(+), 19 deletions(-) (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations') diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/InputDataOperation.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/InputDataOperation.java index 0bbbdeb31..99bd0ebef 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/InputDataOperation.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/InputDataOperation.java @@ -75,7 +75,7 @@ public class InputDataOperation extends BaseOperation { PgpDecryptVerifyInputParcel decryptInput = input.getDecryptInput(); if (decryptInput != null) { - log.add(LogType.MSG_DATA_DECRYPT, 1); + log.add(LogType.MSG_DATA_OPENPGP, 1); PgpDecryptVerifyOperation op = new PgpDecryptVerifyOperation(mContext, mProviderHelper, mProgressable); @@ -175,7 +175,7 @@ public class InputDataOperation extends BaseOperation { out.write(buf, 0, len); } while ((len = is.read(buf)) > 0); - log.add(LogType.MSG_DATA_MIME_LENGTH, 3, totalLength); + log.add(LogType.MSG_DATA_MIME_LENGTH, 3, Long.toString(totalLength)); String charset = bd.getCharset(); // the charset defaults to us-ascii, but we want to default to utf-8 @@ -199,27 +199,26 @@ public class InputDataOperation extends BaseOperation { parser.parse(in); // if no mime data parsed, just return the raw data as fallback - if (outputUris.isEmpty()) { - - log.add(LogType.MSG_DATA_MIME_NONE, 2); - - OpenPgpMetadata metadata; - if (decryptResult != null) { - metadata = decryptResult.getDecryptionMetadata(); - } else { - // if we neither decrypted nor mime-decoded, should this be treated as an error? - // either way, we know nothing about the data - metadata = new OpenPgpMetadata(); - } - - outputUris.add(currentInputUri); - metadatas.add(metadata); + if (!outputUris.isEmpty()) { + log.add(LogType.MSG_DATA_MIME_OK, 2); log.add(LogType.MSG_DATA_OK, 1); return new InputDataResult(InputDataResult.RESULT_OK, log, decryptResult, outputUris, metadatas); } - log.add(LogType.MSG_DATA_MIME_OK, 2); + log.add(LogType.MSG_DATA_MIME_NONE, 2); + + OpenPgpMetadata metadata; + if (decryptResult != null) { + metadata = decryptResult.getDecryptionMetadata(); + } else { + // if we neither decrypted nor mime-decoded, should this be treated as an error? + // either way, we know nothing about the data + metadata = new OpenPgpMetadata(); + } + + outputUris.add(currentInputUri); + metadatas.add(metadata); log.add(LogType.MSG_DATA_OK, 1); return new InputDataResult(InputDataResult.RESULT_OK, log, decryptResult, outputUris, metadatas); 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 70ff7b338..6db2539d5 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 @@ -827,7 +827,7 @@ public abstract class OperationResult implements Parcelable { // InputData Operation MSG_DATA (LogLevel.START, R.string.msg_data), - MSG_DATA_DECRYPT (LogLevel.DEBUG, R.string.msg_data_decrypt), + MSG_DATA_OPENPGP (LogLevel.DEBUG, R.string.msg_data_openpgp), MSG_DATA_ERROR_IO (LogLevel.ERROR, R.string.msg_data_error_io), MSG_DATA_MIME_ERROR (LogLevel.ERROR, R.string.msg_data_mime_error), MSG_DATA_MIME_FILENAME (LogLevel.DEBUG, R.string.msg_data_mime_filename), -- cgit v1.2.3