From 877b9070fa4d7a6b51ae1f75640a6c23cc86c963 Mon Sep 17 00:00:00 2001 From: Ben Komalo Date: Thu, 23 Jun 2011 19:41:47 -0700 Subject: [PATCH] Misc cleanups and avoid logging PII Change-Id: I9f906dabe0dd00a434ff88878f0639c835b2e2a7 --- .../com/android/emailcommon/utility/SSLUtils.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/emailcommon/src/com/android/emailcommon/utility/SSLUtils.java b/emailcommon/src/com/android/emailcommon/utility/SSLUtils.java index 78c0c9b02..4bcd836bd 100644 --- a/emailcommon/src/com/android/emailcommon/utility/SSLUtils.java +++ b/emailcommon/src/com/android/emailcommon/utility/SSLUtils.java @@ -45,7 +45,7 @@ public class SSLUtils { * * @param insecure if true, bypass all SSL certificate checks */ - public synchronized static final SSLCertificateSocketFactory getSSLSocketFactory( + public synchronized static SSLCertificateSocketFactory getSSLSocketFactory( boolean insecure) { if (insecure) { if (sInsecureFactory == null) { @@ -102,7 +102,6 @@ public class SSLUtils { return sb.toString(); } - @SuppressWarnings("unused") private static abstract class StubKeyManager extends X509ExtendedKeyManager { @Override public abstract String chooseClientAlias( String[] keyTypes, Principal[] issuers, Socket socket); @@ -204,15 +203,19 @@ public class SSLUtils { } if (certificateChain == null || privateKey == null) { - throw new CertificateException( - "Can't access certificate from keystore for alias [" + alias + "]"); + throw new CertificateException("Can't access certificate from keystore"); } return new KeyChainKeyManager(alias, certificateChain, privateKey); } private static void logError(String alias, String type, Exception ex) { - Log.e(TAG, "Unable to retrieve " + type + " for [" + alias + "] due to " + ex); + // Avoid logging PII when explicit logging is not on. + if (LOG_ENABLED) { + Log.e(TAG, "Unable to retrieve " + type + " for [" + alias + "] due to " + ex); + } else { + Log.e(TAG, "Unable to retrieve " + type + " due to " + ex); + } } private KeyChainKeyManager(