Changeset 3093


Ignore:
Timestamp:
01/23/12 15:19:20 (4 months ago)
Author:
kasper
Message:

Fixed minor issue when userpreferences indicate that proxy is enabled, but no hostname+port has been specified.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • DataCleaner/trunk/core/src/main/java/org/eobjects/datacleaner/util/HttpXmlUtils.java

    r2503 r3093  
    9292                        final int proxyPort = _userPreferences.getProxyPort(); 
    9393 
    94                         final HttpHost proxy = new HttpHost(proxyHostname, proxyPort); 
    95                         httpClient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy); 
     94                        try { 
     95                                final HttpHost proxy = new HttpHost(proxyHostname, proxyPort); 
     96                                httpClient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy); 
    9697 
    97                         if (_userPreferences.isProxyAuthenticationEnabled()) { 
    98                                 final AuthScope authScope = new AuthScope(proxyHostname, proxyPort); 
    99                                 final UsernamePasswordCredentials credentials = new UsernamePasswordCredentials( 
    100                                                 _userPreferences.getProxyUsername(), _userPreferences.getProxyPassword()); 
    101                                 httpClient.getCredentialsProvider().setCredentials(authScope, credentials); 
     98                                if (_userPreferences.isProxyAuthenticationEnabled()) { 
     99                                        final AuthScope authScope = new AuthScope(proxyHostname, proxyPort); 
     100                                        final UsernamePasswordCredentials credentials = new UsernamePasswordCredentials( 
     101                                                        _userPreferences.getProxyUsername(), _userPreferences.getProxyPassword()); 
     102                                        httpClient.getCredentialsProvider().setCredentials(authScope, credentials); 
     103                                } 
     104                        } catch (Exception e) { 
     105                                // ignore proxy creation and return http client without it 
     106                                logger.error("Unexpected error occurred while initializing HTTP proxy", e); 
    102107                        } 
    103108                } 
Note: See TracChangeset for help on using the changeset viewer.