Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomasz Zarna2008-12-02 12:34:58 +0000
committerTomasz Zarna2008-12-02 12:34:58 +0000
commite6ef3ccad33700ddd4fc24ac1b7ec77b0e523a3c (patch)
treebf35b8edf2f4dd219883b1a1c0fe0d929e7d2949 /bundles/org.eclipse.core.net/src/org
parent0cbe074b0423a0294b5a412db6e0d674cf728fda (diff)
downloadeclipse.platform.team-e6ef3ccad33700ddd4fc24ac1b7ec77b0e523a3c.tar.gz
eclipse.platform.team-e6ef3ccad33700ddd4fc24ac1b7ec77b0e523a3c.tar.xz
eclipse.platform.team-e6ef3ccad33700ddd4fc24ac1b7ec77b0e523a3c.zip
bug 257172: [Net] Get rid of System.getenv(String) invocation
Diffstat (limited to 'bundles/org.eclipse.core.net/src/org')
-rw-r--r--bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/proxy/unix/UnixProxyProvider.java17
1 files changed, 13 insertions, 4 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 661cec9fe..af3838523 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
@@ -11,9 +11,11 @@
*******************************************************************************/
package org.eclipse.core.internal.net.proxy.unix;
+import java.io.IOException;
import java.net.URI;
import java.util.ArrayList;
import java.util.Locale;
+import java.util.Properties;
import org.eclipse.core.internal.net.AbstractProxyProvider;
import org.eclipse.core.internal.net.Activator;
@@ -178,13 +180,20 @@ public class UnixProxyProvider extends AbstractProxyProvider {
}
private String getEnv(String env) {
+ String cmd[] = { "/bin/sh", //$NON-NLS-1$
+ "-c", //$NON-NLS-1$
+ "env | grep -i proxy" }; //$NON-NLS-1$
+ Properties props = new Properties();
try {
- return System.getenv(env);
- } catch (SecurityException e) {
+ props.load(Runtime.getRuntime().exec(cmd).getInputStream());
+ } catch (IOException e) {
Activator.logError(
- "Security exception occured wile getting env variable", e); //$NON-NLS-1$
- return null;
+ "Problem during accessing system variable: " + env, e); //$NON-NLS-1$
+ } catch (IllegalArgumentException e) {
+ Activator.logError(
+ "Problem during accessing system variable: " + env, e); //$NON-NLS-1$
}
+ return props.getProperty(env);
}
private static void loadGnomeLib() {

Back to the top