diff options
author | tkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7> | 2013-07-24 14:58:39 +0000 |
---|---|---|
committer | tkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7> | 2013-07-24 14:58:39 +0000 |
commit | 3edba5d2d9afcc9cb5c94f43219d8a032b5d8d2c (patch) | |
tree | 182bded785d273d98aa71d739b11d42a3398d235 | |
parent | 692c813f44f3f4e79e6dbb3b419448731a176075 (diff) | |
download | pdf-over-3edba5d2d9afcc9cb5c94f43219d8a032b5d8d2c.tar.gz pdf-over-3edba5d2d9afcc9cb5c94f43219d8a032b5d8d2c.tar.bz2 pdf-over-3edba5d2d9afcc9cb5c94f43219d8a032b5d8d2c.zip |
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
-rw-r--r-- | pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java | 49 |
1 files 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()); |