From 3edba5d2d9afcc9cb5c94f43219d8a032b5d8d2c Mon Sep 17 00:00:00 2001 From: tkellner Date: Wed, 24 Jul 2013 14:58:39 +0000 Subject: Workaround to unset proxy settings when cleared git-svn-id: https://joinup.ec.europa.eu/svn/pdf-over/trunk@473 174cde9d-5d70-4d2a-aa98-46368bc2aaf7 --- .../gui/composites/ConfigurationComposite.java | 49 ++++++++++++++++++---- 1 file changed, 40 insertions(+), 9 deletions(-) diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java index fcf3119f..b4b519f1 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java @@ -420,15 +420,46 @@ public class ConfigurationComposite extends StateComposite { this.configManipulator.setSignatureNote(this.configurationContainer .getSignatureNote()); - - this.configManipulator.setProxyHost(this.configurationContainer - .getProxyHost()); - this.configManipulator.setProxyPort(this.configurationContainer - .getProxyPort()); - this.configManipulator.setProxyUser(this.configurationContainer - .getProxyUser()); - this.configManipulator.setProxyPass(this.configurationContainer - .getProxyPass()); + + String hostOld = this.configProvider.getProxyHostPersistent(); + String hostNew = this.configurationContainer.getProxyHost(); + if (hostOld != null && !hostOld.isEmpty() && + (hostNew == null || hostNew.isEmpty())) { + // Proxy has been removed, let's clear the system properties + // Otherwise, the proxy settings wouldn't get removed + System.clearProperty("http.proxyHost"); //$NON-NLS-1$ + System.clearProperty("https.proxyHost"); //$NON-NLS-1$ + } + this.configManipulator.setProxyHost(hostNew); + + int portOld = this.configProvider.getProxyPortPersistent(); + int portNew = this.configurationContainer.getProxyPort(); + if (portOld != -1 && portNew == -1) { + // cf. above + System.clearProperty("http.proxyPort"); //$NON-NLS-1$ + System.clearProperty("https.proxyPort"); //$NON-NLS-1$ + } + this.configManipulator.setProxyPort(portNew); + + String userOld = this.configProvider.getProxyUserPersistent(); + String userNew = this.configurationContainer.getProxyUser(); + if (userOld != null && !userOld.isEmpty() && + (userNew == null || userNew.isEmpty())) { + // cf. above + System.clearProperty("http.proxyUser"); //$NON-NLS-1$ + System.clearProperty("https.proxyUser"); //$NON-NLS-1$ + } + this.configManipulator.setProxyUser(userNew); + + String passOld = this.configProvider.getProxyPassPersistent(); + String passNew = this.configurationContainer.getProxyPass(); + if (passOld != null && passNew == null) { + // cf. above + System.clearProperty("http.proxyPassword"); //$NON-NLS-1$ + System.clearProperty("https.proxyPassword"); //$NON-NLS-1$ + } + this.configManipulator.setProxyPass(passNew); + this.configManipulator.setDefaultEmblem(this.configurationContainer .getEmblem()); -- cgit v1.2.3