aboutsummaryrefslogtreecommitdiffstats
path: root/plugin/icedteanp
diff options
context:
space:
mode:
authorOmair Majid <[email protected]>2013-10-09 12:18:49 -0400
committerOmair Majid <[email protected]>2013-10-09 12:18:49 -0400
commit86a963d444af9480677e7f6413841f6a5061c233 (patch)
tree7a13f8e2bec9aaa02fea77a701284f9659afa14d /plugin/icedteanp
parentf3db9f1486f6b9052f04152ae3c45cdff7a85ea2 (diff)
Remove duplicate key computation in proxy code
Diffstat (limited to 'plugin/icedteanp')
-rw-r--r--plugin/icedteanp/java/sun/applet/PluginProxySelector.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/plugin/icedteanp/java/sun/applet/PluginProxySelector.java b/plugin/icedteanp/java/sun/applet/PluginProxySelector.java
index cb4f58d..25689f5 100644
--- a/plugin/icedteanp/java/sun/applet/PluginProxySelector.java
+++ b/plugin/icedteanp/java/sun/applet/PluginProxySelector.java
@@ -116,7 +116,7 @@ public class PluginProxySelector extends JNLPProxySelector {
proxy = new Proxy(type, socketAddr);
- String uriKey = uri.getScheme() + "://" + uri.getHost();
+ String uriKey = computeKey(uri);
proxyCache.put(uriKey, proxy);
} else {
PluginDebug.debug("Proxy ", proxyURI, " cannot be used for ", uri, ". Falling back to DIRECT");
@@ -145,8 +145,7 @@ public class PluginProxySelector extends JNLPProxySelector {
* @return The cached Proxy. null if there is no suitable cached proxy.
*/
private Proxy checkCache(URI uri) {
-
- String uriKey = uri.getScheme() + "://" + uri.getHost();
+ String uriKey = computeKey(uri);
if (proxyCache.get(uriKey) != null) {
return proxyCache.get(uriKey);
}
@@ -154,6 +153,11 @@ public class PluginProxySelector extends JNLPProxySelector {
return null;
}
+ /** Compute a key to use for the proxy cache */
+ private String computeKey(URI uri) {
+ return uri.getScheme() + "://" + uri.getHost();
+ }
+
public static String convertUriSchemeForProxyQuery(URI uri) throws URISyntaxException, UnsupportedEncodingException {
// there is no easy way to get SOCKS proxy info. So, we tell mozilla that we want proxy for
// an HTTP uri in case of non http/ftp protocols. If we get back a SOCKS proxy, we can