diff --git a/local-proj-repo/proxy/proxy_vole/1.1.1/_remote.repositories b/local-proj-repo/proxy/proxy_vole/1.1.1/_remote.repositories
new file mode 100644
index 00000000..af1a3e82
--- /dev/null
+++ b/local-proj-repo/proxy/proxy_vole/1.1.1/_remote.repositories
@@ -0,0 +1,4 @@
+#NOTE: This is a Maven Resolver internal implementation file, its format can be changed without prior notice.
+#Wed Sep 18 17:42:04 PDT 2024
+proxy_vole-1.1.1.jar>=
+proxy_vole-1.1.1.pom>=
diff --git a/local-proj-repo/proxy/proxy_vole/1.1.1/proxy_vole-1.1.1.jar b/local-proj-repo/proxy/proxy_vole/1.1.1/proxy_vole-1.1.1.jar
new file mode 100644
index 00000000..aa31d7fc
Binary files /dev/null and b/local-proj-repo/proxy/proxy_vole/1.1.1/proxy_vole-1.1.1.jar differ
diff --git a/local-proj-repo/proxy/proxy_vole/1.1.1/proxy_vole-1.1.1.pom b/local-proj-repo/proxy/proxy_vole/1.1.1/proxy_vole-1.1.1.pom
new file mode 100644
index 00000000..90b9a4f4
--- /dev/null
+++ b/local-proj-repo/proxy/proxy_vole/1.1.1/proxy_vole-1.1.1.pom
@@ -0,0 +1,73 @@
+
+ 4.0.0
+ de.rosstauscher.proxy_vole
+ proxy_vole
+ 1.1.1
+ proxy-vole
+ A Java library to auto detect the platform network proxy settings.
+
+The library provides some proxy setting search strategies to read the proxy settings from the system config (Windows, KDE, Gnome, OSX), browser config (Firefox, IE), or environment variables, ... and provides you an ready to use proxy selector.
+
+ UTF-8
+ UTF-8
+ 1.8
+ 1.8
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+ 2.9.1
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-source-plugin
+ 2.2.1
+
+
+ **/*.java
+ dll/**/*
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+ 2.4
+
+
+ src/main/resources/META-INF/MANIFEST.MF
+
+
+
+
+
+
+
+
+
+ org.mozilla
+ rhino
+ 1.7R4
+ true
+
+
+ junit
+ junit
+ 4.13.2
+
+
+
+ Swiss AviationSoftware
+ http://swiss-as.com
+
+ https://github.com/SwissAS/proxy_vole
+
+
diff --git a/local-proj-repo/proxy/proxy_vole/maven-metadata-local.xml b/local-proj-repo/proxy/proxy_vole/maven-metadata-local.xml
new file mode 100644
index 00000000..1cfb6ddb
--- /dev/null
+++ b/local-proj-repo/proxy/proxy_vole/maven-metadata-local.xml
@@ -0,0 +1,12 @@
+
+
+ proxy
+ proxy_vole
+
+ 1.1.1
+
+ 1.1.1
+
+ 20240919004204
+
+
diff --git a/pom.xml b/pom.xml
index 63d3c643..5d0045e7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -50,6 +50,12 @@
swtmac_aarch64
4.32
+
+
+ proxy
+ proxy_vole
+ 1.1.1
+
com.google.code.gson
diff --git a/src/main/java/com/salesforce/dataloader/config/Config.java b/src/main/java/com/salesforce/dataloader/config/Config.java
index b74f8148..db3a2116 100644
--- a/src/main/java/com/salesforce/dataloader/config/Config.java
+++ b/src/main/java/com/salesforce/dataloader/config/Config.java
@@ -668,6 +668,13 @@ private void setDefaults() {
setDefaultValue(PROCESS_EXIT_WITH_ERROR_ON_FAILED_ROWS_BATCH_MODE, false);
setDefaultValue(INCLUDE_RICH_TEXT_FIELD_DATA_IN_QUERY_RESULTS, false);
setDefaultValue(OAUTH_INSTANCE_URL, false);
+ AppUtil.setSystemProxyValues();
+ String proxyHost = System.getProperty("http.proxyHost");
+ String proxyPort = System.getProperty("http.proxyPort");
+ if (proxyHost != null && !proxyHost.isBlank()) {
+ setDefaultValue(PROXY_HOST, proxyHost);
+ setDefaultValue(PROXY_PORT, proxyPort);
+ }
}
/**
@@ -971,6 +978,7 @@ private void load(InputStream in) throws ConfigInitializationException, IOExcept
try {
Properties propsFromFile = new LinkedProperties();
propsFromFile.load(in);
+ removeEmptyProperties(propsFromFile);
properties.putAll(propsFromFile);
for (String roprop : READ_ONLY_PROPERTY_NAMES) {
if (propsFromFile.containsKey(roprop)) {
@@ -1233,6 +1241,7 @@ public void save() throws IOException, GeneralSecurityException {
removeUnsupportedProperties();
removeDecryptedProperties();
removeCLIOptionsFromProperties();
+ removeEmptyProperties(this.properties);
FileOutputStream out = null;
try {
@@ -1334,6 +1343,11 @@ private void removeCLIOptionsFromProperties() {
}
}
+ private void removeEmptyProperties(Properties props) {
+ props.entrySet().removeIf(entry ->
+ (entry.getValue() == null || entry.getValue().toString().isBlank()));
+ }
+
/**
* Save statistics from the last run
*/
@@ -1441,7 +1455,7 @@ private void setValue(String name, T value, boolean skipIfAlreadySet) {
*/
private void setProperty(String name, String newValue, boolean skipIfAlreadySet) {
final String oldValue = getString(name);
- if (skipIfAlreadySet && oldValue != null && !oldValue.isEmpty()) {
+ if (skipIfAlreadySet && oldValue != null && !oldValue.isBlank()) {
// do not override the old value
return;
}
diff --git a/src/main/java/com/salesforce/dataloader/util/AppUtil.java b/src/main/java/com/salesforce/dataloader/util/AppUtil.java
index 656268ca..1d324ada 100644
--- a/src/main/java/com/salesforce/dataloader/util/AppUtil.java
+++ b/src/main/java/com/salesforce/dataloader/util/AppUtil.java
@@ -33,6 +33,8 @@
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
+import java.net.InetSocketAddress;
+import java.net.Proxy;
import java.net.ProxySelector;
import java.net.URI;
import java.net.URISyntaxException;
@@ -51,6 +53,7 @@
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
@@ -63,6 +66,7 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+import com.btr.proxy.search.ProxySearch;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -535,4 +539,43 @@ public static T deserializeJsonToObject (InputStream in, Class tmpClass)
mapper.setTimeZone(TimeZone.getTimeZone("GMT"));
return mapper.readValue(in, tmpClass);
}
+
+ public static void setSystemProxyValues() {
+ // Use the static factory method getDefaultProxySearch to create a proxy search instance
+ // configured with the default proxy search strategies for the current environment.
+ ProxySearch proxySearch = ProxySearch.getDefaultProxySearch();
+
+ // Invoke the proxy search. This will create a ProxySelector with the detected proxy settings.
+ ProxySelector proxySelector = proxySearch.getProxySelector();
+
+ // Install this ProxySelector as default ProxySelector for all connections.
+ ProxySelector.setDefault(proxySelector);
+
+ System.setProperty("java.net.useSystemProxies", "true");
+ logger.debug("detecting proxies");
+ List l = null;
+ try {
+ l = ProxySelector.getDefault().select(new URI("https://www.salesforce.com"));
+ }
+ catch (URISyntaxException e) {
+ e.printStackTrace();
+ }
+ if (l != null) {
+ for (Iterator iter = l.iterator(); iter.hasNext();) {
+ java.net.Proxy proxy = (java.net.Proxy) iter.next();
+ logger.debug("System proxy type: " + proxy.type());
+
+ InetSocketAddress addr = (InetSocketAddress) proxy.address();
+
+ if (addr == null) {
+ logger.debug("No system proxy");
+ } else {
+ logger.info("System proxy hostname: " + addr.getHostName());
+ System.setProperty("http.proxyHost", addr.getHostName());
+ logger.info("System proxy port: " + addr.getPort());
+ System.setProperty("http.proxyPort", Integer.toString(addr.getPort()));
+ }
+ }
+ }
+ }
}