@@ -59,15 +59,23 @@ public void run()
5959 {
6060 try
6161 {
62- KeyManagerFactory keyManagerFactory = KeyManagerFactory .getInstance ("PKIX" );
62+ boolean isJdk15 = System .getProperty ("java.version" ).indexOf ("1.5." ) == 0 ;
63+
64+ KeyManagerFactory keyManagerFactory = isJdk15 ?
65+ KeyManagerFactory .getInstance ("PKIX" , ProviderUtils .PROVIDER_NAME_BCJSSE ) :
66+ KeyManagerFactory .getInstance ("PKIX" );
6367
6468 keyManagerFactory .init (keyStore , password );
6569
66- TrustManagerFactory trustManagerFactory = TrustManagerFactory .getInstance ("PKIX" );
70+ TrustManagerFactory trustManagerFactory = isJdk15 ?
71+ TrustManagerFactory .getInstance ("PKIX" , ProviderUtils .PROVIDER_NAME_BCJSSE ) :
72+ TrustManagerFactory .getInstance ("PKIX" );
6773
6874 trustManagerFactory .init (serverStore );
6975
70- SSLContext context = SSLContext .getInstance ("TLS" );
76+ SSLContext context = isJdk15 ?
77+ SSLContext .getInstance ("TLS" , ProviderUtils .PROVIDER_NAME_BCJSSE ) :
78+ SSLContext .getInstance ("TLS" );
7179
7280 context .init (keyManagerFactory .getKeyManagers (), trustManagerFactory .getTrustManagers (), null );
7381
@@ -92,9 +100,10 @@ public void run()
92100
93101 ss .close ();
94102 }
95- catch (Exception e )
103+ catch (Throwable e )
96104 {
97- e .printStackTrace ();
105+ Thread .currentThread ().interrupt ();
106+ latch .countDown ();
98107 }
99108 }
100109 };
@@ -109,7 +118,7 @@ public void run()
109118 }
110119 catch (InterruptedException e )
111120 {
112-
121+ e . printStackTrace ();
113122 }
114123 }
115124}
0 commit comments