mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
make SSLExceptionsHelper methods static, do not keep instance - it's possible since now it uses ThreadLocal
This commit is contained in:
@@ -24,15 +24,15 @@ package org.jetbrains.idea.svn;
|
||||
public class SSLExceptionsHelper {
|
||||
private final static ThreadLocal<String> myAdditionalInfo = new ThreadLocal<String>();
|
||||
|
||||
public void addInfo(final String s) {
|
||||
public static void addInfo(final String s) {
|
||||
myAdditionalInfo.set(s);
|
||||
}
|
||||
|
||||
public void removeInfo() {
|
||||
public static void removeInfo() {
|
||||
myAdditionalInfo.remove();
|
||||
}
|
||||
|
||||
public String getAddInfo() {
|
||||
public static String getAddInfo() {
|
||||
return myAdditionalInfo.get();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,7 +70,6 @@ public class SvnAuthenticationManager extends DefaultSVNAuthenticationManager im
|
||||
private IdeaSVNHostOptionsProvider myLocalHostOptionsProvider;
|
||||
private final ThreadLocalSavePermissions mySavePermissions;
|
||||
private final Map<Thread, String> myKeyAlgorithm;
|
||||
private SSLExceptionsHelper myHelper;
|
||||
private boolean myArtificialSaving;
|
||||
|
||||
public SvnAuthenticationManager(final Project project, final File configDirectory) {
|
||||
@@ -361,7 +360,7 @@ public class SvnAuthenticationManager extends DefaultSVNAuthenticationManager im
|
||||
@Override
|
||||
public void acknowledgeConnectionSuccessful(SVNURL url) {
|
||||
CommonProxy.getInstance().removeNoProxy(url.getProtocol(), url.getHost(), url.getPort());
|
||||
if (myHelper != null) myHelper.removeInfo();
|
||||
SSLExceptionsHelper.removeInfo();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -371,7 +370,7 @@ public class SvnAuthenticationManager extends DefaultSVNAuthenticationManager im
|
||||
SVNErrorMessage errorMessage,
|
||||
SVNAuthentication authentication,
|
||||
SVNURL url) throws SVNException {
|
||||
if (myHelper != null) myHelper.removeInfo();
|
||||
SSLExceptionsHelper.removeInfo();
|
||||
CommonProxy.getInstance().removeNoProxy(url.getProtocol(), url.getHost(), url.getPort());
|
||||
boolean successSaving = false;
|
||||
myListener.getMulticaster().acknowledge(accepted, kind, realm, errorMessage, authentication);
|
||||
@@ -389,7 +388,7 @@ public class SvnAuthenticationManager extends DefaultSVNAuthenticationManager im
|
||||
}
|
||||
|
||||
public ISVNProxyManager getProxyManager(SVNURL url) throws SVNException {
|
||||
if (myHelper != null) myHelper.addInfo("Accessing URL: " + url.toString());
|
||||
SSLExceptionsHelper.addInfo("Accessing URL: " + url.toString());
|
||||
CommonProxy.getInstance().noProxy(url.getProtocol(), url.getHost(), url.getPort());
|
||||
// this code taken from default manager (changed for system properties reading)
|
||||
String host = url.getHost();
|
||||
@@ -985,8 +984,4 @@ public class SvnAuthenticationManager extends DefaultSVNAuthenticationManager im
|
||||
return mySuccess;
|
||||
}
|
||||
}
|
||||
|
||||
public void setHelper(SSLExceptionsHelper helper) {
|
||||
myHelper = helper;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,7 +143,6 @@ public class SvnVcs extends AbstractVcs<CommittedChangeList> {
|
||||
private EditFileProvider myEditFilesProvider;
|
||||
private SvnCommittedChangesProvider myCommittedChangesProvider;
|
||||
private final VcsShowSettingOption myCheckoutOptions;
|
||||
private final static SSLExceptionsHelper myHelper = new SSLExceptionsHelper();
|
||||
|
||||
private ChangeProvider myChangeProvider;
|
||||
private MergeProvider myMergeProvider;
|
||||
@@ -282,7 +281,6 @@ public class SvnVcs extends AbstractVcs<CommittedChangeList> {
|
||||
// remove used some time before old notification group ids
|
||||
correctNotificationIds();
|
||||
myChecker = new SvnExecutableChecker(myProject);
|
||||
myConfiguration.getAuthenticationManager(this).setHelper(myHelper);
|
||||
}
|
||||
|
||||
private void correctNotificationIds() {
|
||||
@@ -959,7 +957,7 @@ public class SvnVcs extends AbstractVcs<CommittedChangeList> {
|
||||
private final boolean myLoggingEnabled;
|
||||
private final boolean myLogNative;
|
||||
private final Logger myLog;
|
||||
private final static long ourMaxFrequency = 10000;
|
||||
private final static long ourErrorNotificationInterval = 10000;
|
||||
private long myPreviousTime = 0;
|
||||
|
||||
public JavaSVNDebugLogger(boolean loggingEnabled, boolean logNative, Logger log) {
|
||||
@@ -976,9 +974,9 @@ public class SvnVcs extends AbstractVcs<CommittedChangeList> {
|
||||
public void log(final SVNLogType logType, final Throwable th, final Level logLevel) {
|
||||
if (th instanceof SSLHandshakeException) {
|
||||
final long time = System.currentTimeMillis();
|
||||
if ((time - myPreviousTime) > ourMaxFrequency) {
|
||||
if ((time - myPreviousTime) > ourErrorNotificationInterval) {
|
||||
myPreviousTime = time;
|
||||
String info = myHelper.getAddInfo();
|
||||
String info = SSLExceptionsHelper.getAddInfo();
|
||||
info = info == null ? "" : " (" + info + ") ";
|
||||
if (th.getCause() instanceof CertificateException) {
|
||||
PopupUtil.showBalloonForActiveComponent("Subversion: " + info + th.getCause().getMessage(), MessageType.ERROR);
|
||||
|
||||
Reference in New Issue
Block a user