Skip to content

Commit

Permalink
[ZEPPELIN-2152] Fix for npe in Helium loading when no proxies are set
Browse files Browse the repository at this point in the history
  • Loading branch information
necosta committed May 31, 2017
1 parent 3940a41 commit 3fd80d5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Expand Up @@ -164,9 +164,10 @@ private ProxyConfig getProxyConfig(boolean isSecure) {
System.getenv("HTTPS_PROXY") : System.getenv("https_proxy");

try {
if (isSecure)
if (isSecure && StringUtils.isNotBlank(httpsProxy))
proxies.add(generateProxy("secure", new URI(httpsProxy)));
else proxies.add(generateProxy("insecure", new URI(httpProxy)));
else if(!isSecure && StringUtils.isNotBlank(httpProxy))
proxies.add(generateProxy("insecure", new URI(httpProxy)));
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
}
Expand Down
Expand Up @@ -118,12 +118,12 @@ private HttpHost getProxy(String uri) {

try {
String scheme = new URI(uri).getScheme();
if (scheme.toLowerCase().startsWith("https") && !StringUtils.isBlank(httpsProxy)) {
if (scheme.toLowerCase().startsWith("https") && StringUtils.isNotBlank(httpsProxy)) {
URI httpsProxyUri = new URI(httpsProxy);
return new HttpHost(httpsProxyUri.getHost(),
httpsProxyUri.getPort(), httpsProxyUri.getScheme());
}
else if (scheme.toLowerCase().startsWith("http") && !StringUtils.isBlank(httpProxy)){
else if (scheme.toLowerCase().startsWith("http") && StringUtils.isNotBlank(httpProxy)){
URI httpProxyUri = new URI(httpProxy);
return new HttpHost(httpProxyUri.getHost(),
httpProxyUri.getPort(), httpProxyUri.getScheme());
Expand Down

0 comments on commit 3fd80d5

Please sign in to comment.