Merge pull request #7412 from litetex/code-cleanup
Some code cleanup(s)
This commit is contained in:
commit
6cd25d7e55
5 changed files with 39 additions and 59 deletions
|
|
@ -10,9 +10,8 @@ import javax.net.ssl.HttpsURLConnection;
|
|||
import javax.net.ssl.SSLContext;
|
||||
import javax.net.ssl.SSLSocket;
|
||||
import javax.net.ssl.SSLSocketFactory;
|
||||
import javax.net.ssl.TrustManager;
|
||||
|
||||
import static org.schabi.newpipe.MainActivity.DEBUG;
|
||||
import android.util.Log;
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -21,6 +20,7 @@ import static org.schabi.newpipe.MainActivity.DEBUG;
|
|||
*/
|
||||
public class TLSSocketFactoryCompat extends SSLSocketFactory {
|
||||
|
||||
private static final String TAG = "TLSSocketFactoryCom";
|
||||
|
||||
private static TLSSocketFactoryCompat instance = null;
|
||||
|
||||
|
|
@ -32,14 +32,6 @@ public class TLSSocketFactoryCompat extends SSLSocketFactory {
|
|||
internalSSLSocketFactory = context.getSocketFactory();
|
||||
}
|
||||
|
||||
|
||||
public TLSSocketFactoryCompat(final TrustManager[] tm)
|
||||
throws KeyManagementException, NoSuchAlgorithmException {
|
||||
final SSLContext context = SSLContext.getInstance("TLS");
|
||||
context.init(null, tm, new java.security.SecureRandom());
|
||||
internalSSLSocketFactory = context.getSocketFactory();
|
||||
}
|
||||
|
||||
public static TLSSocketFactoryCompat getInstance()
|
||||
throws NoSuchAlgorithmException, KeyManagementException {
|
||||
if (instance != null) {
|
||||
|
|
@ -53,9 +45,7 @@ public class TLSSocketFactoryCompat extends SSLSocketFactory {
|
|||
try {
|
||||
HttpsURLConnection.setDefaultSSLSocketFactory(getInstance());
|
||||
} catch (NoSuchAlgorithmException | KeyManagementException e) {
|
||||
if (DEBUG) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
Log.e(TAG, "Unable to setAsDefault", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue