aboutsummaryrefslogtreecommitdiffstats
path: root/netx/net/sourceforge/jnlp/runtime
diff options
context:
space:
mode:
authorOmair Majid <[email protected]>2013-09-23 12:34:25 -0400
committerOmair Majid <[email protected]>2013-09-23 12:34:25 -0400
commit0b4378d462bf9e44afe71d8c87adf682dd116c50 (patch)
treec91b0ace61b30e086d54c2a09f3d748a09c8461a /netx/net/sourceforge/jnlp/runtime
parent9ba69baff18dd24b207e0a8b6ad76133fe4ea536 (diff)
Unit tests for JNLPProxySelector
This contains one functional change: - String host = uri.getSchemeSpecificPart().split(":")[0]; + String host = uri.getHost(); Given the URI of "socket://example.org", the first line evaluates to "//example.org", while the second one (correctly) evaluates to "example.org".
Diffstat (limited to 'netx/net/sourceforge/jnlp/runtime')
-rw-r--r--netx/net/sourceforge/jnlp/runtime/JNLPProxySelector.java16
-rw-r--r--netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java2
2 files changed, 7 insertions, 11 deletions
diff --git a/netx/net/sourceforge/jnlp/runtime/JNLPProxySelector.java b/netx/net/sourceforge/jnlp/runtime/JNLPProxySelector.java
index db5a9b7..b8fd25d 100644
--- a/netx/net/sourceforge/jnlp/runtime/JNLPProxySelector.java
+++ b/netx/net/sourceforge/jnlp/runtime/JNLPProxySelector.java
@@ -82,19 +82,14 @@ public abstract class JNLPProxySelector extends ProxySelector {
// FIXME what is this? where should it be used?
private String overrideHosts = null;
- /**
- * Creates a new JNLPProxySelector.
- */
- public JNLPProxySelector() {
- parseConfiguration();
+ public JNLPProxySelector(DeploymentConfiguration config) {
+ parseConfiguration(config);
}
/**
* Initialize this ProxySelector by reading the configuration
*/
- private void parseConfiguration() {
- DeploymentConfiguration config = JNLPRuntime.getConfiguration();
-
+ private void parseConfiguration(DeploymentConfiguration config) {
proxyType = Integer.valueOf(config.getProperty(DeploymentConfiguration.KEY_PROXY_TYPE));
String autoConfigString = config.getProperty(DeploymentConfiguration.KEY_PROXY_AUTO_CONFIG_URL);
@@ -240,7 +235,7 @@ public abstract class JNLPProxySelector extends ProxySelector {
return true;
}
} else if (scheme.equals("socket")) {
- String host = uri.getSchemeSpecificPart().split(":")[0];
+ String host = uri.getHost();
if (bypassLocal && isLocalHost(host)) {
return true;
@@ -368,7 +363,8 @@ public abstract class JNLPProxySelector extends ProxySelector {
* suitable for java.
* @param pacString a string indicating proxies. For example
* "PROXY foo.bar:3128; DIRECT"
- * @return a list of Proxy objects represeting the parsed string.
+ * @return a list of Proxy objects representing the parsed string. In
+ * case of malformed input, an empty list may be returned
*/
public static List<Proxy> getProxiesFromPacResult(String pacString) {
List<Proxy> proxies = new ArrayList<Proxy>();
diff --git a/netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java b/netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java
index 816807b..a2fcb7d 100644
--- a/netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java
+++ b/netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java
@@ -265,7 +265,7 @@ public class JNLPRuntime {
// plug in a custom authenticator and proxy selector
Authenticator.setDefault(new JNLPAuthenticator());
- ProxySelector.setDefault(new BrowserAwareProxySelector());
+ ProxySelector.setDefault(new BrowserAwareProxySelector(config));
// Restrict access to netx classes
Security.setProperty("package.access",