Skip to content

Commit

Permalink
Make log messages clearer
Browse files Browse the repository at this point in the history
If someone reads "failed" together with a full stacktrace, then this
suggests at first though that something fatal has happened. But this is
not the case if appTrustManager failed.
  • Loading branch information
Flowdalic committed Jul 18, 2015
1 parent 43da4ba commit 9e30ffd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/de/duenndns/ssl/MemorizingTrustManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ public void checkCertTrusted(X509Certificate[] chain, String authType, boolean i
else
appTrustManager.checkClientTrusted(chain, authType);
} catch (CertificateException ae) {
LOGGER.log(Level.FINER, "checkCertTrusted: appTrustManager failed", ae);
LOGGER.log(Level.FINER, "checkCertTrusted: appTrustManager did not verify certificate. Will fall back to secondary verification mechanisms (if any).", ae);
// if the cert is stored in our appTrustManager, we ignore expiredness
if (isExpiredException(ae)) {
LOGGER.log(Level.INFO, "checkCertTrusted: accepting expired certificate from keystore");
Expand All @@ -425,8 +425,10 @@ public void checkCertTrusted(X509Certificate[] chain, String authType, boolean i
return;
}
try {
if (defaultTrustManager == null)
if (defaultTrustManager == null) {
LOGGER.fine("No defaultTrustManager set. Verification failed, throwing " + ae);
throw ae;
}
LOGGER.log(Level.FINE, "checkCertTrusted: trying defaultTrustManager");
if (isServer)
defaultTrustManager.checkServerTrusted(chain, authType);
Expand Down

1 comment on commit 9e30ffd

@Aminbin
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

Please sign in to comment.