From 301b2760ba37347ad98e896058fceb0c0bc349e4 Mon Sep 17 00:00:00 2001 From: "David A. Velasco" Date: Wed, 5 Sep 2012 16:02:42 +0200 Subject: [PATCH] Fixed java.lang.ClassCastException entered in the previous update --- src/com/owncloud/android/network/SslAnalyzer.java | 5 +++-- src/com/owncloud/android/ui/dialog/SslValidatorDialog.java | 3 +-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/com/owncloud/android/network/SslAnalyzer.java b/src/com/owncloud/android/network/SslAnalyzer.java index 2f02c4b6fb..f9769e62d7 100644 --- a/src/com/owncloud/android/network/SslAnalyzer.java +++ b/src/com/owncloud/android/network/SslAnalyzer.java @@ -42,9 +42,10 @@ public class SslAnalyzer { */ public static Exception getRecoverableException(RemoteOperationResult result) { Exception ret = null; - SSLException e = (SSLException)result.getException(); + SSLException e = null; Throwable cause = null; - if (e != null) { + if (result.getException() instanceof SSLException) { + e = (SSLException)result.getException(); if (e instanceof SSLPeerUnverifiedException) { ret = e; diff --git a/src/com/owncloud/android/ui/dialog/SslValidatorDialog.java b/src/com/owncloud/android/ui/dialog/SslValidatorDialog.java index 87e33f7b6a..90fad539bf 100644 --- a/src/com/owncloud/android/ui/dialog/SslValidatorDialog.java +++ b/src/com/owncloud/android/ui/dialog/SslValidatorDialog.java @@ -69,8 +69,7 @@ public class SslValidatorDialog extends Dialog { * by setting the certificate as reliable. */ public static SslValidatorDialog newInstance(Context context, RemoteOperationResult result, OnSslValidatorListener listener) { - Exception e = SslAnalyzer.getRecoverableException(result); - if (e != null) { + if (SslAnalyzer.isRecoverable(result)) { SslValidatorDialog dialog = new SslValidatorDialog(context, listener); return dialog; } else {