Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Keller2016-10-10 16:22:50 -0400
committerDani Megert2016-10-14 04:44:30 -0400
commit325d702ca6f1f6c773f165211beaf693dc251740 (patch)
treeda5b30c554c0b162ec279bccd797c9933f6ffa44
parentea2c0a3d37ce594f34cd00475f616e89361a7c1e (diff)
downloadeclipse.platform.team-325d702ca6f1f6c773f165211beaf693dc251740.tar.gz
eclipse.platform.team-325d702ca6f1f6c773f165211beaf693dc251740.tar.xz
eclipse.platform.team-325d702ca6f1f6c773f165211beaf693dc251740.zip
Bug 505670: UnixProxyProvider fails for http_proxy without protocol://
Change-Id: I7cda5e28f7f9af3cf54a350dfc6befac87231e43 Signed-off-by: Markus Keller <markus_keller@ch.ibm.com>
-rw-r--r--bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/proxy/unix/UnixProxyProvider.java13
1 files changed, 11 insertions, 2 deletions
diff --git a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/proxy/unix/UnixProxyProvider.java b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/proxy/unix/UnixProxyProvider.java
index e479de04e..572c90275 100644
--- a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/proxy/unix/UnixProxyProvider.java
+++ b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/proxy/unix/UnixProxyProvider.java
@@ -16,6 +16,7 @@ import java.lang.reflect.Method;
import java.net.URI;
import java.util.ArrayList;
import java.util.Locale;
+import java.util.Objects;
import java.util.Properties;
import org.eclipse.core.internal.net.AbstractProxyProvider;
@@ -151,10 +152,18 @@ public class UnixProxyProvider extends AbstractProxyProvider {
Policy.debug("Got proxyEnv: " + proxyEnv); //$NON-NLS-1$
if (proxyEnv != null) {
+ int colonInd = proxyEnv.indexOf(":"); //$NON-NLS-1$
+ if (colonInd !=-1 && proxyEnv.length() > colonInd + 2 && !"//".equals(proxyEnv.substring(colonInd + 1, colonInd + 3))) { //$NON-NLS-1$
+ proxyEnv = "http://" + proxyEnv; //$NON-NLS-1$
+ }
URI uri = new URI(proxyEnv);
pd = new ProxyData(protocol);
- pd.setHost(uri.getHost());
- pd.setPort(uri.getPort());
+ pd.setHost(Objects.requireNonNull(uri.getHost(), "no host in " + proxyEnv)); //$NON-NLS-1$
+ int port = uri.getPort();
+ if (port == -1) {
+ throw new IllegalStateException("no port in " + proxyEnv); //$NON-NLS-1$
+ }
+ pd.setPort(port);
String userInfo = uri.getUserInfo();
if (userInfo != null) {
String user = null;

Back to the top