@@ -268,10 +268,10 @@ static String getErrorText(KonException ex) {
268268 break ;
269269 case IMPORT_KEY :
270270 errorText = Tr .tr ("Can't create personal key from key files." ) + " " ;
271- if (ex .getExceptionClass ().equals (IOException .class )) {
271+ if (ex .getCauseClass ().equals (IOException .class )) {
272272 errorText += eol + Tr .tr ("Is the public key file valid?" );
273273 }
274- if (ex .getExceptionClass ().equals (CertificateException .class )) {
274+ if (ex .getCauseClass ().equals (CertificateException .class )) {
275275 errorText += eol + Tr .tr ("Are all key files valid?" );
276276 }
277277 break ;
@@ -299,19 +299,27 @@ static String getErrorText(KonException ex) {
299299 break ;
300300 case CLIENT_CONNECT :
301301 errorText = Tr .tr ("Can't connect to server." );
302- if (ex .getExceptionClass ().equals (SmackException .ConnectionException .class )) {
302+
303+ if (ex .getCauseClass ().equals (SmackException .ConnectionException .class )) {
303304 errorText += eol + Tr .tr ("Is the server address correct?" );
304- }
305- if (ex .getExceptionClass ().equals (SSLHandshakeException .class )) {
305+ } else if (ex .getCauseClass ().equals (SSLHandshakeException .class )) {
306306 errorText += eol + Tr .tr ("The server rejects the key." );
307- }
308- if (ex .getExceptionClass ().equals (SmackException .NoResponseException .class )) {
307+ } else if (ex .getCauseClass ().equals (SmackException .NoResponseException .class )) {
309308 errorText += eol + Tr .tr ("The server does not respond." );
309+ } else {
310+ Throwable cause = ex .getCause ();
311+ if (cause != null ) {
312+ Throwable causeCause = cause .getCause ();
313+ if (causeCause != null &&
314+ causeCause .getClass ().equals (SSLHandshakeException .class )) {
315+ errorText += eol + Tr .tr ("The server certificate could not be validated." );
316+ }
317+ }
310318 }
311319 break ;
312320 case CLIENT_LOGIN :
313321 errorText = Tr .tr ("Can't login to server." );
314- if (ex .getExceptionClass ().equals (SASLErrorException .class )) {
322+ if (ex .getCauseClass ().equals (SASLErrorException .class )) {
315323 errorText += eol + Tr .tr ("The server rejects the account. Is the specified server correct and the account valid?" );
316324 }
317325 break ;
0 commit comments