X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/5a25a6a698c75d437f794f1993bbd1d281af75e9..a8fade7369bc8d1752dc4ba5fe07935cac84e96f:/src/com/owncloud/android/ui/dialog/SslValidatorDialog.java diff --git a/src/com/owncloud/android/ui/dialog/SslValidatorDialog.java b/src/com/owncloud/android/ui/dialog/SslValidatorDialog.java index 201fd7e1..6ae4156d 100644 --- a/src/com/owncloud/android/ui/dialog/SslValidatorDialog.java +++ b/src/com/owncloud/android/ui/dialog/SslValidatorDialog.java @@ -2,9 +2,8 @@ * Copyright (C) 2012-2013 ownCloud Inc. * * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. + * it under the terms of the GNU General Public License version 2, + * as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -19,6 +18,7 @@ package com.owncloud.android.ui.dialog; import java.io.IOException; +import java.security.GeneralSecurityException; import java.security.KeyStoreException; import java.security.NoSuchAlgorithmException; import java.security.cert.CertificateException; @@ -32,7 +32,6 @@ import javax.security.auth.x500.X500Principal; import android.app.Dialog; import android.content.Context; import android.os.Bundle; -import android.util.Log; import android.view.View; import android.view.Window; import android.widget.Button; @@ -65,7 +64,7 @@ public class SslValidatorDialog extends Dialog { * @param context Android context where the dialog will live. * @param result Result of a failed remote operation. * @param listener Object to notice when the server certificate was added to the local certificates store. - * @return A new SslValidatorDialog instance, or NULL if the operation can not be recovered + * @return A new SslValidatorDialog instance. NULL if the operation can not be recovered * by setting the certificate as reliable. */ public static SslValidatorDialog newInstance(Context context, RemoteOperationResult result, OnSslValidatorListener listener) { @@ -113,7 +112,13 @@ public class SslValidatorDialog extends Dialog { else Log_OC.d(TAG, "Nobody there to notify the certificate was saved"); - } catch (Exception e) { + } catch (GeneralSecurityException e) { + dismiss(); + if (mListener != null) + mListener.onFailedSavingCertificate(); + Log_OC.e(TAG, "Server certificate could not be saved in the known servers trust store ", e); + + } catch (IOException e) { dismiss(); if (mListener != null) mListener.onFailedSavingCertificate();