Revision 30182 trunk/libraries/libCorePlugin/src/com/iver/core/preferences/network/FirewallPage.java

View differences:

FirewallPage.java
234 234
		return this;
235 235
	}
236 236

  
237
	public String createURL(String host, String port){
238
		StringBuffer strUrl = new StringBuffer();
239
		// add "http://" prefix if it wasn't included.
240
		strUrl.append(host.toLowerCase().startsWith("http://")
241
				? host.toLowerCase() : "http://"+ host.toLowerCase());
242

  
243
		// add port
244
		strUrl.append(!port.equals("")
245
				? ":" + port : "");
246
		return strUrl.toString();
247
	}
248
	
237 249
	public void storeValues() throws StoreException{
238 250
		Properties systemSettings = System.getProperties();
239 251
		URL httpURL, socksURL;
240 252

  
241 253
		try {
242
			StringBuffer strUrl = new StringBuffer();
243
			// add "http://" prefix if it wasn't included.
244
			strUrl.append(httpHost.getText().toLowerCase().startsWith("http://")
245
					? httpHost.getText().toLowerCase() : "http://"+httpHost.getText().toLowerCase());
246

  
247
			// add port
248
			strUrl.append(!httpPort.getText().equals("")
249
					? ":"+httpPort.getText() : "");
250
			httpURL = new URL(strUrl.toString());
254
			
255
			httpURL = new URL(createURL(httpHost.getText(), httpPort.getText()));
251 256
			prefs.putBoolean("firewall.http.enabled", httpEnabled.isSelected());
252 257
			prefs.put("firewall.http.host", httpHost.getText());
253 258
			prefs.put("firewall.http.port", httpPort.getText());
......
258 263
			prefs.put("firewall.http.nonProxyHosts", httpNonProxy.getText());
259 264

  
260 265
			if (httpEnabled.isSelected()) {
266
				systemSettings.put("http.proxySet", "true");
261 267
				systemSettings.put("http.proxyHost", httpURL.getHost());
262 268
				systemSettings.put("http.proxyPort", httpURL.getPort()+"");
263 269
				systemSettings.put("http.proxyUserName", proxyUser);
264 270
				systemSettings.put("http.proxyPassword", proxyPassword);
265 271
			} else {
272
				systemSettings.put("http.proxySet", "false");
266 273
				systemSettings.remove("http.proxyHost");
267 274
				systemSettings.remove("http.proxyPort");
268 275
				systemSettings.remove("http.proxyUserName");
......
291 298
		}
292 299

  
293 300
		try {
294
			socksURL = new URL(socksHost.getText()+":"+socksPort.getText());
301
			socksURL = new URL(createURL(socksHost.getText(), socksPort.getText()));
295 302

  
296 303
			prefs.putBoolean("firewall.socks.enabled", socksEnabled.isSelected());
297 304
			prefs.put("firewall.socks.host", socksHost.getText());

Also available in: Unified diff