Citronen
Citronen

Reputation: 4490

IProxyService.setProxyData affects system properties

In a test, I'm trying to programmatically change the Eclipse proxy settings without directly affecting the System properties.

My current attempt is as such:

    httpProxyData.setHost(host)
    httpProxyData.setPort(port)
    httpProxyData.setUserid(userId)
    httpProxyData.setPassword(password)

    proxyService.setProxyData((IProxyData[]) [
        httpProxyData
    ])

My proxy service settings are as follows:

    proxyService.setProxiesEnabled(true)
    proxyService.setSystemProxiesEnabled(false)

When proxyService.setProxyData executes, System.getproperty("http.proxyHost") is immediately changed to host. The IProxyService API states that System properties will not be affected. I want it such that the System properties are only affected by me setting System.setProperty(..., ...) at a later or earlier time.

Am I doing something incorrectly?

Upvotes: 0

Views: 51

Answers (1)

greg-449
greg-449

Reputation: 111218

The doc says 'doesn't affect settings of the system proxies' - I think they mean it does not change the settings in the operating system.

Looking at the code it always call System.setProperty (which only sets the property for the current JVM).

Upvotes: 1

Related Questions