From b0959914f2a6623c6155f9f8736eab5bf47b01fa Mon Sep 17 00:00:00 2001 From: Shubhangi-cs Date: Thu, 21 Dec 2023 16:33:31 +0530 Subject: [PATCH] Rework --- .../source/transport/SuccessFactorsTransporter.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/cdap/plugin/successfactors/source/transport/SuccessFactorsTransporter.java b/src/main/java/io/cdap/plugin/successfactors/source/transport/SuccessFactorsTransporter.java index 3a90b81..26d0201 100644 --- a/src/main/java/io/cdap/plugin/successfactors/source/transport/SuccessFactorsTransporter.java +++ b/src/main/java/io/cdap/plugin/successfactors/source/transport/SuccessFactorsTransporter.java @@ -21,6 +21,7 @@ import com.github.rholder.retry.RetryerBuilder; import com.github.rholder.retry.StopStrategies; import com.github.rholder.retry.WaitStrategies; +import com.google.common.base.Strings; import io.cdap.cdap.api.retry.RetryableException; import io.cdap.plugin.successfactors.common.exception.TransportException; import io.cdap.plugin.successfactors.common.util.ResourceConstants; @@ -197,6 +198,11 @@ private Request buildRequest(URL endpoint, String mediaType) { /** * Builds and configures an OkHttpClient with the specified proxy settings and authentication credentials. + * @param proxyUrl The URL of the proxy server (e.g., "http://proxy.example.com:8080"). + * Set to null or an empty string to bypass proxy configuration. + * @param proxyUsername The username for proxy authentication. Set to null or an empty string if not required. + * @param proxyPassword The password for proxy authentication. Set to null or an empty string if not required. + * @return An OkHttpClient configured with the specified proxy settings and authentication credentials. */ private OkHttpClient buildConfiguredClient(String proxyUrl, String proxyUsername, String proxyPassword) throws MalformedURLException, TransportException { @@ -207,7 +213,7 @@ private OkHttpClient buildConfiguredClient(String proxyUrl, String proxyUsername Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(url.getHost(), url.getPort())); builder.proxy(proxy); - if (proxyUsername != null && !proxyUsername.isEmpty() && proxyPassword != null && !proxyPassword.isEmpty()) { + if (Strings.isNullOrEmpty(proxyUsername) && Strings.isNullOrEmpty(proxyPassword)) { builder.proxyAuthenticator(new Authenticator() { @Override public Request authenticate(Route route, Response response) {