removed unnecessary code, bug fix

This commit is contained in:
nuclearfog 2020-06-25 17:40:02 +02:00
parent 7623cd154b
commit a5d62c5385
No known key found for this signature in database
GPG Key ID: ED35E22099354A64
2 changed files with 14 additions and 10 deletions

View File

@ -22,19 +22,23 @@ abstract class ProxySetup {
ProxyConnection proxyConnection;
ProxyAuthenticator proxyLogin;
if (settings.isProxyEnabled()) {
proxyConnection = new ProxyConnection(settings);
if (settings.isProxyAuthSet()) {
proxyLogin = new ProxyAuthenticator(settings);
} else {
proxyLogin = new ProxyAuthenticator();
}
} else {
proxyConnection = new ProxyConnection();
}
if (settings.isProxyAuthSet()) {
proxyLogin = new ProxyAuthenticator(settings);
} else {
proxyLogin = new ProxyAuthenticator();
}
ProxySelector.setDefault(proxyConnection);
Authenticator.setDefault(proxyLogin);
try {
ProxySelector.setDefault(proxyConnection);
Authenticator.setDefault(proxyLogin);
} catch (SecurityException sErr) {
sErr.printStackTrace();
}
}

View File

@ -380,9 +380,9 @@ public class GlobalSettings {
* @return proxy port integer
*/
public int getProxyPortNumber() {
if (proxyPort.isEmpty() || proxyPort.length() > 5)
return 0;
return Integer.parseInt(proxyPort);
if (isProxyEnabled && !proxyPort.isEmpty() && proxyPort.length() < 6)
return Integer.parseInt(proxyPort);
return 0;
}
/**