Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSzymon Brandys2010-10-07 07:31:02 -0400
committerSzymon Brandys2010-10-07 07:31:02 -0400
commit74e980f56fdc87140a2956dd8b89cfcb7224a675 (patch)
treedf168e662b2a73a88ad7b61f4c3b6dd4ca8da12a /bundles
parent02a98a5efe94cc82a3a027c25b0a2d6e5a2c0466 (diff)
downloadeclipse.platform.team-74e980f56fdc87140a2956dd8b89cfcb7224a675.tar.gz
eclipse.platform.team-74e980f56fdc87140a2956dd8b89cfcb7224a675.tar.xz
eclipse.platform.team-74e980f56fdc87140a2956dd8b89cfcb7224a675.zip
bug 325367 - [Net] Unnecessary double check bypass settings in AbstractProxyProvider.select(URI)
Diffstat (limited to 'bundles')
-rw-r--r--bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/AbstractProxyProvider.java27
-rw-r--r--bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/WindowsProxyProvider.java16
-rw-r--r--bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/proxy/unix/UnixProxyProvider.java38
3 files changed, 41 insertions, 40 deletions
diff --git a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/AbstractProxyProvider.java b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/AbstractProxyProvider.java
index 5bd72ea27..c9cbf0513 100644
--- a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/AbstractProxyProvider.java
+++ b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/AbstractProxyProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 Oakland Software Incorporated and others
+ * Copyright (c) 2008, 2010 Oakland Software Incorporated and others
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -28,30 +28,7 @@ public abstract class AbstractProxyProvider {
* the URI that a connection is required to
* @return an array of proxies for the given URI
*/
- public IProxyData[] select(URI uri) {
- String[] nonProxyHosts = getNonProxiedHosts();
-
- if (nonProxyHosts != null) {
- String host = uri.getHost();
- for (int npIndex = 0; npIndex < nonProxyHosts.length; npIndex++) {
- if (host.equals(nonProxyHosts[npIndex])) {
- return new IProxyData[0];
- }
- }
- }
-
- IProxyData[] proxies = getProxyData(uri);
-
- if (Policy.DEBUG) {
- Policy.debug("AbstractProxyProvider#select result for [" + uri + "]"); //$NON-NLS-1$ //$NON-NLS-2$
- for (int i = 0; i < proxies.length; i++)
- System.out.println(" " + proxies[i]); //$NON-NLS-1$
- }
-
- return proxies;
- }
-
- protected abstract IProxyData[] getProxyData(URI uri);
+ public abstract IProxyData[] select(URI uri);
protected abstract IProxyData[] getProxyData();
diff --git a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/WindowsProxyProvider.java b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/WindowsProxyProvider.java
index aec448954..20d8f8c33 100644
--- a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/WindowsProxyProvider.java
+++ b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/WindowsProxyProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2009 compeople AG and others.
+ * Copyright (c) 2008, 2010 compeople AG and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -43,12 +43,18 @@ public class WindowsProxyProvider extends AbstractProxyProvider {
winHttpProxyProvider = null;
}
}
-
- protected IProxyData[] getProxyData(URI uri) {
+
+ public IProxyData[] select(URI uri) {
+ IProxyData[] proxies = new IProxyData[0];
if (jWinHttpLoaded) {
- return winHttpProxyProvider.getProxyData(uri);
+ proxies = winHttpProxyProvider.getProxyData(uri);
}
- return new IProxyData[0];
+ if (Policy.DEBUG) {
+ Policy.debug("WindowsProxyProvider#select result for [" + uri + "]"); //$NON-NLS-1$ //$NON-NLS-2$
+ for (int i = 0; i < proxies.length; i++)
+ System.out.println(" " + proxies[i]); //$NON-NLS-1$
+ }
+ return proxies;
}
protected IProxyData[] getProxyData() {
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 e2d3f0b73..fe7439f36 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2009 Oakland Software Incorporated and others
+ * Copyright (c) 2008, 2010 Oakland Software Incorporated and others
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -21,6 +21,7 @@ import org.eclipse.core.internal.net.AbstractProxyProvider;
import org.eclipse.core.internal.net.Activator;
import org.eclipse.core.internal.net.Policy;
import org.eclipse.core.internal.net.ProxyData;
+import org.eclipse.core.internal.net.StringMatcher;
import org.eclipse.core.internal.net.StringUtil;
import org.eclipse.core.net.proxy.IProxyData;
@@ -47,18 +48,30 @@ public class UnixProxyProvider extends AbstractProxyProvider {
public UnixProxyProvider() {
// Nothing to initialize
}
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.core.internal.net.AbstractProxyProvider#getProxyData(java.net.URI)
- */
- public IProxyData[] getProxyData(URI uri) {
+
+ public IProxyData[] select(URI uri) {
+ String[] nonProxyHosts = getNonProxiedHosts();
+ if (nonProxyHosts != null) {
+ String host = uri.getHost();
+ for (int npIndex = 0; npIndex < nonProxyHosts.length; npIndex++) {
+ if (matchesFilter(host, nonProxyHosts[npIndex])) {
+ return new IProxyData[0];
+ }
+ }
+ }
+ IProxyData[] proxies = new IProxyData[0];
if (uri.getScheme() != null) {
ProxyData pd = getSystemProxyInfo(uri.getScheme());
- return pd != null ? new IProxyData[] { pd } : new IProxyData[0];
+ proxies = pd != null ? new IProxyData[] { pd } : new IProxyData[0];
+ } else {
+ proxies = getProxyData();
+ }
+ if (Policy.DEBUG) {
+ Policy.debug("UnixProxyProvider#select result for [" + uri + "]"); //$NON-NLS-1$ //$NON-NLS-2$
+ for (int i = 0; i < proxies.length; i++)
+ System.out.println(" " + proxies[i]); //$NON-NLS-1$
}
- return getProxyData();
+ return proxies;
}
public IProxyData[] getProxyData() {
@@ -243,6 +256,11 @@ public class UnixProxyProvider extends AbstractProxyProvider {
for (int i = 0; i < strs.length; i++)
System.out.println(i + ": " + strs[i]); //$NON-NLS-1$
}
+
+ private boolean matchesFilter(String host, String filter) {
+ StringMatcher matcher = new StringMatcher(filter, true, false);
+ return matcher.match(host);
+ }
protected static native void gconfInit();

Back to the top