private static String computeMessage(IOException ex) { String message = ex.getMessage(); // For CertPathValidationErrors, the CertPath is in the exception object but not // in the exception message. Pull it out into the message, because it would be // useful for debugging. if (ex instanceof SSLHandshakeException) { Throwable innerCause = ex.getCause(); if (innerCause instanceof CertPathValidatorException) { CertPathValidatorException cpve = (CertPathValidatorException) innerCause; message += "[CERT PATH: " + cpve.getCertPath() + "]"; } } return message; }
if (cause instanceof CertPathValidatorException) { CertPathValidatorException certException = (CertPathValidatorException) cause; CertPath certPath = certException.getCertPath(); List<? extends Certificate> certificates = certPath .getCertificates();