Skip to content

Commit ca6ede2

Browse files
committed
tweak to exception handling to reduce real cause vanishing.
1 parent a20b027 commit ca6ede2

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

tls/src/main/java/org/bouncycastle/jsse/provider/ProvX509TrustManager.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import java.security.Provider;
88
import java.security.cert.CertPath;
99
import java.security.cert.CertPathBuilder;
10+
import java.security.cert.CertPathBuilderException;
1011
import java.security.cert.CertSelector;
1112
import java.security.cert.CertStore;
1213
import java.security.cert.CertStoreParameters;
@@ -308,6 +309,14 @@ private X509Certificate[] validateChain(X509Certificate[] chain, String authType
308309

309310
return trustedChain;
310311
}
312+
catch (CertificateException e)
313+
{
314+
throw e;
315+
}
316+
catch (CertPathBuilderException e)
317+
{
318+
throw new CertificateException(e.getMessage(), e.getCause());
319+
}
311320
catch (GeneralSecurityException e)
312321
{
313322
throw new CertificateException("Unable to construct a valid chain", e);

0 commit comments

Comments
 (0)