diff options
author | Manuel Bentele | 2021-12-16 09:51:08 +0100 |
---|---|---|
committer | Manuel Bentele | 2021-12-16 09:51:08 +0100 |
commit | c7977de19b84d18e88833ad5461665aecd21fb64 (patch) | |
tree | 0c7506579d34122f3257ca3c5e1d8cac4838928a /src | |
parent | Update log4j because of the CVE-2021-44228 security flaw (diff) | |
download | tmlite-bwlp-c7977de19b84d18e88833ad5461665aecd21fb64.tar.gz tmlite-bwlp-c7977de19b84d18e88833ad5461665aecd21fb64.tar.xz tmlite-bwlp-c7977de19b84d18e88833ad5461665aecd21fb64.zip |
Remove handler for proxy settings
Diffstat (limited to 'src')
5 files changed, 2 insertions, 74 deletions
diff --git a/src/main/java/org/openslx/satserver/util/ProxyHandler.java b/src/main/java/org/openslx/satserver/util/ProxyHandler.java deleted file mode 100644 index f70a496..0000000 --- a/src/main/java/org/openslx/satserver/util/ProxyHandler.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.openslx.satserver.util; - -import org.openslx.network.ProxyConfiguration; - -/** - * Class for handling proxy configuration in task manager. - * - * @author bjoern - * - */ -public class ProxyHandler -{ - private static boolean hasDoneConfigProxy = false; - private static final Object proxyMutex = new Object(); - - /** - * Do proxy setup if not done already - */ - public static void configProxy() - { - configProxy( false ); - } - - /** - * Do proxy setup if not done already, or if explicitly forced. - * - * @param force Do setup even if already done - */ - public static synchronized void configProxy( boolean force ) - { - synchronized ( proxyMutex ) { - if ( !hasDoneConfigProxy || force ) { - ProxyConfiguration.configProxy(); - hasDoneConfigProxy = true; - } - } - } -} diff --git a/src/main/java/org/openslx/taskmanager/tasks/DownloadFile.java b/src/main/java/org/openslx/taskmanager/tasks/DownloadFile.java index 352aac5..e7f4d80 100644 --- a/src/main/java/org/openslx/taskmanager/tasks/DownloadFile.java +++ b/src/main/java/org/openslx/taskmanager/tasks/DownloadFile.java @@ -10,7 +10,6 @@ import java.net.URLConnection; import org.apache.commons.io.FileUtils; import org.apache.commons.io.FilenameUtils; import org.openslx.satserver.util.Exec; -import org.openslx.satserver.util.ProxyHandler; import org.openslx.satserver.util.Util; import org.openslx.taskmanager.api.AbstractTask; @@ -54,8 +53,6 @@ public class DownloadFile extends AbstractTask BufferedInputStream in = null; FileOutputStream fout = null; - // Handle proxy settings before opening connection for downloading. - ProxyHandler.configProxy(); try { File tmpFile = File.createTempFile( "bwlp-", ".tmp", null ); connection = new URL( this.url ).openConnection(); diff --git a/src/main/java/org/openslx/taskmanager/tasks/DownloadFiles.java b/src/main/java/org/openslx/taskmanager/tasks/DownloadFiles.java index 942eca9..be3569d 100644 --- a/src/main/java/org/openslx/taskmanager/tasks/DownloadFiles.java +++ b/src/main/java/org/openslx/taskmanager/tasks/DownloadFiles.java @@ -24,7 +24,6 @@ import java.util.concurrent.atomic.AtomicBoolean; import org.apache.commons.io.FileUtils; import org.apache.commons.io.FilenameUtils; import org.openslx.satserver.util.Exec; -import org.openslx.satserver.util.ProxyHandler; import org.openslx.satserver.util.Util; import org.openslx.taskmanager.api.AbstractTask; @@ -120,8 +119,7 @@ public class DownloadFiles extends AbstractTask return false; } final Path tmpDir = td; - // Handle proxy settings before opening connection for downloading. - ProxyHandler.configProxy(); + ExecutorService tp = Executors.newFixedThreadPool( files.length > 3 ? 3 : files.length ); final AtomicBoolean retval = new AtomicBoolean( true ); for ( final Task t : this.files ) { diff --git a/src/main/java/org/openslx/taskmanager/tasks/DownloadText.java b/src/main/java/org/openslx/taskmanager/tasks/DownloadText.java index 3acc647..098b284 100644 --- a/src/main/java/org/openslx/taskmanager/tasks/DownloadText.java +++ b/src/main/java/org/openslx/taskmanager/tasks/DownloadText.java @@ -7,7 +7,6 @@ import java.net.URL; import java.net.URLConnection; import java.nio.charset.StandardCharsets; -import org.openslx.satserver.util.ProxyHandler; import org.openslx.satserver.util.Util; import org.openslx.taskmanager.api.AbstractTask; @@ -39,9 +38,7 @@ public class DownloadText extends AbstractTask { URLConnection connection = null; BufferedInputStream in = null; - - // Before open connection, handle proxy settings. - ProxyHandler.configProxy(); + try { connection = new URL( this.url ).openConnection(); in = new BufferedInputStream( connection.getInputStream() ); diff --git a/src/main/java/org/openslx/taskmanager/tasks/ReloadProxy.java b/src/main/java/org/openslx/taskmanager/tasks/ReloadProxy.java deleted file mode 100644 index b3216dd..0000000 --- a/src/main/java/org/openslx/taskmanager/tasks/ReloadProxy.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.openslx.taskmanager.tasks; - -import org.openslx.satserver.util.ProxyHandler; -import org.openslx.taskmanager.api.AbstractTask; - -/** - * Just force reloading and setting up proxy configuration. - * Used after modifying settings in the webgui. - */ -public class ReloadProxy extends AbstractTask -{ - - @Override - protected boolean initTask() - { - return true; - } - - @Override - protected boolean execute() - { - ProxyHandler.configProxy( true ); - return true; - } - -} |