mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
EA-45804 (NPE: SocksAuthenticatorManager.unregister)
This commit is contained in:
+7
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.intellij.cvsSupport2.connections.ssh;
|
||||
|
||||
import com.intellij.cvsSupport2.config.ProxySettings;
|
||||
import com.intellij.openapi.components.ServiceManager;
|
||||
import com.intellij.openapi.util.KeyValue;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
@@ -30,9 +31,9 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class SocksAuthenticatorManager {
|
||||
private final static String SOCKS_REQUESTING_PROTOCOL = "SOCKS";
|
||||
|
||||
private final Object myLock;
|
||||
private CvsProxySelector mySelector;
|
||||
private volatile CvsProxySelector mySelector;
|
||||
|
||||
public static SocksAuthenticatorManager getInstance() {
|
||||
return ServiceManager.getService(SocksAuthenticatorManager.class);
|
||||
@@ -53,6 +54,9 @@ public class SocksAuthenticatorManager {
|
||||
|
||||
public void unregister(final ConnectionSettings connectionSettings) {
|
||||
SshLogger.debug("unregister in authenticator");
|
||||
if (!connectionSettings.isUseProxy()) return;
|
||||
final int proxyType = connectionSettings.getProxyType();
|
||||
if (proxyType != ProxySettings.SOCKS4 && proxyType != ProxySettings.SOCKS5) return;
|
||||
mySelector.unregister(connectionSettings.getHostName(), connectionSettings.getPort());
|
||||
CommonProxy.getInstance().removeCustomAuth(getClass().getName());
|
||||
}
|
||||
|
||||
+6
-7
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -26,19 +26,18 @@ import java.io.IOException;
|
||||
import java.net.Socket;
|
||||
|
||||
public class SshProxyFactory {
|
||||
private SshProxyFactory() {
|
||||
}
|
||||
|
||||
private SshProxyFactory() {}
|
||||
|
||||
@Nullable
|
||||
public static ProxyData createAndRegister(final ConnectionSettings connectionSettings) {
|
||||
ProxyData result = null;
|
||||
if (! connectionSettings.isUseProxy()) return null;
|
||||
if (!connectionSettings.isUseProxy()) return null;
|
||||
final int type = connectionSettings.getProxyType();
|
||||
if ((ProxySettings.SOCKS4 == type) || (ProxySettings.SOCKS5 == type)) {
|
||||
ProxyData result = null;
|
||||
if (ProxySettings.SOCKS4 == type || ProxySettings.SOCKS5 == type) {
|
||||
result = new SocksProxyData(connectionSettings);
|
||||
SocksAuthenticatorManager.getInstance().register(connectionSettings);
|
||||
} else if (ProxySettings.HTTP == type) {
|
||||
/*String proxyHost, int proxyPort, String proxyUser, String proxyPass*/
|
||||
result = new HTTPProxyData(connectionSettings.getProxyHostName(), connectionSettings.getProxyPort(),
|
||||
connectionSettings.getProxyLogin(), connectionSettings.getProxyPassword());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user