diff --git a/src/com/seafile/seadroid2/SSLTrustManager.java b/src/com/seafile/seadroid2/SSLTrustManager.java index b54410219..85f07334c 100644 --- a/src/com/seafile/seadroid2/SSLTrustManager.java +++ b/src/com/seafile/seadroid2/SSLTrustManager.java @@ -11,18 +11,23 @@ import java.util.LinkedList; import java.util.List; import java.util.Map; +import java.util.Set; -import javax.net.ssl.*; +import javax.net.ssl.SSLException; +import javax.net.ssl.SSLSocketFactory; +import javax.net.ssl.TrustManager; +import javax.net.ssl.X509TrustManager; + +import org.apache.http.conn.ssl.BrowserCompatHostnameVerifier; +import org.apache.http.conn.ssl.X509HostnameVerifier; -import android.os.Build; import android.util.Log; import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; import com.google.common.collect.Maps; +import com.google.common.collect.Sets; import com.seafile.seadroid2.account.Account; -import org.apache.http.conn.ssl.BrowserCompatHostnameVerifier; -import org.apache.http.conn.ssl.X509HostnameVerifier; public final class SSLTrustManager { public enum SslFailureReason { @@ -145,7 +150,9 @@ public List orderCerts(X509Certificate[] certificates) { return ImmutableList.of(); } - List certs = Lists.newArrayList(certificates); + Set all = Sets.newHashSet(certificates); + + List certs = Lists.newArrayList(all); // certs.addAll(Arrays.asList(certificates)); X509Certificate certChain = certs.get(0); certs.remove(certChain);