From 4e72e150ad24ee459cf481151d7c39f657a3e22f Mon Sep 17 00:00:00 2001
From: zzz <zzz@mail.i2p>
Date: Sun, 2 Nov 2014 17:36:28 +0000
Subject: [PATCH] reduce log level of expired certs on android

---
 core/java/src/net/i2p/crypto/KeyStoreUtil.java | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/core/java/src/net/i2p/crypto/KeyStoreUtil.java b/core/java/src/net/i2p/crypto/KeyStoreUtil.java
index fb690b7cf6..3cd641ad68 100644
--- a/core/java/src/net/i2p/crypto/KeyStoreUtil.java
+++ b/core/java/src/net/i2p/crypto/KeyStoreUtil.java
@@ -229,7 +229,12 @@ public class KeyStoreUtil {
             try {
                 cert.checkValidity();
             } catch (CertificateExpiredException cee) {
-                error("Rejecting expired X509 Certificate: " + file.getAbsolutePath(), cee);
+                String s = "Rejecting expired X509 Certificate: " + file.getAbsolutePath();
+                // Android often has old system certs
+                if (SystemVersion.isAndroid())
+                    warn(s, cee);
+                else
+                    error(s, cee);
                 return false;
             } catch (CertificateNotYetValidException cnyve) {
                 error("Rejecting X509 Certificate not yet valid: " + file.getAbsolutePath(), cnyve);
@@ -463,6 +468,11 @@ public class KeyStoreUtil {
         log(I2PAppContext.getGlobalContext(), Log.INFO, msg, null);
     }
 
+    /** @since 0.9.17 */
+    private static void warn(String msg, Throwable t) {
+        log(I2PAppContext.getGlobalContext(), Log.WARN, msg, t);
+    }
+
     private static void error(String msg, Throwable t) {
         log(I2PAppContext.getGlobalContext(), Log.ERROR, msg, t);
     }
-- 
GitLab