Changeset 6348 in josm


Ignore:
Timestamp:
2013-10-31T21:14:35+01:00 (11 years ago)
Author:
Don-vip
Message:

fix #7019 - Don't perform proxy resolution when not needed (slows down startup and preferences save of instances frequently switching between "no proxy" and "manual proxy" if the proxy cannot be resolved)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/io/DefaultProxySelector.java

    r6265 r6348  
    100100            proxyPolicy = ProxyPolicy.NO_PROXY;
    101101        } else {
    102             proxyPolicy= ProxyPolicy.fromName(value);
     102            proxyPolicy = ProxyPolicy.fromName(value);
    103103            if (proxyPolicy == null) {
    104104                Main.warn(tr("Unexpected value for preference ''{0}'' found. Got ''{1}''. Will use no proxy.", ProxyPreferencesPanel.PROXY_POLICY, value));
     
    108108        String host = Main.pref.get(ProxyPreferencesPanel.PROXY_HTTP_HOST, null);
    109109        int port = parseProxyPortValue(ProxyPreferencesPanel.PROXY_HTTP_PORT, Main.pref.get(ProxyPreferencesPanel.PROXY_HTTP_PORT, null));
    110         if (host != null && !host.trim().isEmpty() && port > 0) {
    111             httpProxySocketAddress = new InetSocketAddress(host,port);
    112         } else {
    113             httpProxySocketAddress = null;
    114             if (proxyPolicy.equals(ProxyPolicy.USE_HTTP_PROXY)) {
     110        httpProxySocketAddress = null;
     111        if (proxyPolicy.equals(ProxyPolicy.USE_HTTP_PROXY)) {
     112            if (host != null && !host.trim().isEmpty() && port > 0) {
     113                httpProxySocketAddress = new InetSocketAddress(host, port);
     114            } else {
    115115                Main.warn(tr("Unexpected parameters for HTTP proxy. Got host ''{0}'' and port ''{1}''.", host, port));
    116116                Main.warn(tr("The proxy will not be used."));
     
    120120        host = Main.pref.get(ProxyPreferencesPanel.PROXY_SOCKS_HOST, null);
    121121        port = parseProxyPortValue(ProxyPreferencesPanel.PROXY_SOCKS_PORT, Main.pref.get(ProxyPreferencesPanel.PROXY_SOCKS_PORT, null));
    122         if (host != null && !host.trim().isEmpty() && port > 0) {
    123             socksProxySocketAddress = new InetSocketAddress(host,port);
    124         } else {
    125             socksProxySocketAddress = null;
    126             if (proxyPolicy.equals(ProxyPolicy.USE_SOCKS_PROXY)) {
     122        socksProxySocketAddress = null;
     123        if (proxyPolicy.equals(ProxyPolicy.USE_SOCKS_PROXY)) {
     124            if (host != null && !host.trim().isEmpty() && port > 0) {
     125                socksProxySocketAddress = new InetSocketAddress(host,port);
     126            } else {
    127127                Main.warn(tr("Unexpected parameters for SOCKS proxy. Got host ''{0}'' and port ''{1}''.", host, port));
    128128                Main.warn(tr("The proxy will not be used."));
Note: See TracChangeset for help on using the changeset viewer.