mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-24 01:32:16 -05:00
More debugging output
This commit is contained in:
parent
f841203f5f
commit
e7cbf975ac
@ -199,10 +199,12 @@ public class PgpDecryptVerify {
|
|||||||
|
|
||||||
return decryptVerify(in, 0);
|
return decryptVerify(in, 0);
|
||||||
} catch (PGPException e) {
|
} catch (PGPException e) {
|
||||||
|
Log.d(Constants.TAG, "PGPException", e);
|
||||||
OperationLog log = new OperationLog();
|
OperationLog log = new OperationLog();
|
||||||
log.add(LogType.MSG_DC_ERROR_PGP_EXCEPTION, 1);
|
log.add(LogType.MSG_DC_ERROR_PGP_EXCEPTION, 1);
|
||||||
return new DecryptVerifyResult(DecryptVerifyResult.RESULT_ERROR, log);
|
return new DecryptVerifyResult(DecryptVerifyResult.RESULT_ERROR, log);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
Log.d(Constants.TAG, "IOException", 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);
|
||||||
@ -754,7 +756,8 @@ public class PgpDecryptVerify {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (signature != null) try {
|
if (signature != null) {
|
||||||
|
try {
|
||||||
updateProgress(R.string.progress_verifying_signature, 90, 100);
|
updateProgress(R.string.progress_verifying_signature, 90, 100);
|
||||||
log.add(LogType.MSG_DC_CLEAR_SIGNATURE_CHECK, indent);
|
log.add(LogType.MSG_DC_CLEAR_SIGNATURE_CHECK, indent);
|
||||||
|
|
||||||
@ -785,8 +788,10 @@ public class PgpDecryptVerify {
|
|||||||
signatureResultBuilder.setValidSignature(validSignature);
|
signatureResultBuilder.setValidSignature(validSignature);
|
||||||
|
|
||||||
} catch (SignatureException e) {
|
} catch (SignatureException e) {
|
||||||
|
Log.d(Constants.TAG, "SignatureException", e);
|
||||||
return new DecryptVerifyResult(DecryptVerifyResult.RESULT_ERROR, log);
|
return new DecryptVerifyResult(DecryptVerifyResult.RESULT_ERROR, log);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
updateProgress(R.string.progress_done, 100, 100);
|
updateProgress(R.string.progress_done, 100, 100);
|
||||||
|
|
||||||
|
@ -782,7 +782,7 @@ public class KeychainIntentService extends IntentService implements Progressable
|
|||||||
message = e.getMessage();
|
message = e.getMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.e(Constants.TAG, "KeychainIntentService Exception: ", e);
|
Log.d(Constants.TAG, "KeychainIntentService Exception: ", e);
|
||||||
|
|
||||||
Bundle data = new Bundle();
|
Bundle data = new Bundle();
|
||||||
data.putString(KeychainIntentServiceHandler.DATA_ERROR, message);
|
data.putString(KeychainIntentServiceHandler.DATA_ERROR, message);
|
||||||
|
@ -32,7 +32,9 @@ import org.sufficientlysecure.keychain.service.results.SingletonResult;
|
|||||||
import org.sufficientlysecure.keychain.util.Log;
|
import org.sufficientlysecure.keychain.util.Log;
|
||||||
import org.sufficientlysecure.keychain.ui.util.Notify;
|
import org.sufficientlysecure.keychain.ui.util.Notify;
|
||||||
|
|
||||||
|
import java.io.StreamTokenizer;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
public class DecryptTextActivity extends ActionBarActivity {
|
public class DecryptTextActivity extends ActionBarActivity {
|
||||||
|
|
||||||
@ -117,7 +119,9 @@ public class DecryptTextActivity extends ActionBarActivity {
|
|||||||
// When sending to Keychain Decrypt via share menu
|
// When sending to Keychain Decrypt via share menu
|
||||||
if ("text/plain".equals(type)) {
|
if ("text/plain".equals(type)) {
|
||||||
String sharedText = extras.getString(Intent.EXTRA_TEXT);
|
String sharedText = extras.getString(Intent.EXTRA_TEXT);
|
||||||
|
Log.dEscaped(Constants.TAG, "sharedText incoming: " + sharedText);
|
||||||
sharedText = getPgpContent(sharedText);
|
sharedText = getPgpContent(sharedText);
|
||||||
|
Log.dEscaped(Constants.TAG, "sharedText fixed: " + sharedText);
|
||||||
|
|
||||||
if (sharedText != null) {
|
if (sharedText != null) {
|
||||||
loadFragment(savedInstanceState, sharedText);
|
loadFragment(savedInstanceState, sharedText);
|
||||||
|
@ -21,6 +21,9 @@ import android.os.Bundle;
|
|||||||
|
|
||||||
import org.sufficientlysecure.keychain.Constants;
|
import org.sufficientlysecure.keychain.Constants;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.StreamTokenizer;
|
||||||
|
import java.io.StringReader;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@ -53,6 +56,18 @@ public final class Log {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void dEscaped(String tag, String msg) {
|
||||||
|
if (Constants.DEBUG) {
|
||||||
|
android.util.Log.d(tag, removeUnicodeAndEscapeChars(msg));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void dEscaped(String tag, String msg, Throwable tr) {
|
||||||
|
if (Constants.DEBUG) {
|
||||||
|
android.util.Log.d(tag, removeUnicodeAndEscapeChars(msg), tr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void i(String tag, String msg) {
|
public static void i(String tag, String msg) {
|
||||||
if (Constants.DEBUG) {
|
if (Constants.DEBUG) {
|
||||||
android.util.Log.i(tag, msg);
|
android.util.Log.i(tag, msg);
|
||||||
@ -116,4 +131,34 @@ public final class Log {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String removeUnicodeAndEscapeChars(String input) {
|
||||||
|
StringBuilder buffer = new StringBuilder(input.length());
|
||||||
|
for (int i = 0; i < input.length(); i++) {
|
||||||
|
if ((int) input.charAt(i) > 256) {
|
||||||
|
buffer.append("\\u").append(Integer.toHexString((int) input.charAt(i)));
|
||||||
|
} else {
|
||||||
|
if (input.charAt(i) == '\n') {
|
||||||
|
buffer.append("\\n");
|
||||||
|
} else if (input.charAt(i) == '\t') {
|
||||||
|
buffer.append("\\t");
|
||||||
|
} else if (input.charAt(i) == '\r') {
|
||||||
|
buffer.append("\\r");
|
||||||
|
} else if (input.charAt(i) == '\b') {
|
||||||
|
buffer.append("\\b");
|
||||||
|
} else if (input.charAt(i) == '\f') {
|
||||||
|
buffer.append("\\f");
|
||||||
|
} else if (input.charAt(i) == '\'') {
|
||||||
|
buffer.append("\\'");
|
||||||
|
} else if (input.charAt(i) == '\"') {
|
||||||
|
buffer.append("\\");
|
||||||
|
} else if (input.charAt(i) == '\\') {
|
||||||
|
buffer.append("\\\\");
|
||||||
|
} else {
|
||||||
|
buffer.append(input.charAt(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return buffer.toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user