Skip to content

Commit d460e2d

Browse files
committed
remove EnvironmentUtils
1 parent b6a07ef commit d460e2d

File tree

5 files changed

+8
-88
lines changed

5 files changed

+8
-88
lines changed

aliyun-java-sdk-core/src/main/java/com/aliyuncs/DefaultAcsClient.java

-1
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,6 @@ private <T extends AcsResponse> HttpResponse doRealAction(AcsRequest<T> request,
319319
String regionId, AlibabaCloudCredentials credentials, Signer signer, FormatType format)
320320
throws ClientException, ServerException {
321321

322-
323322
doActionWithProxy(request.getSysProtocol(), System.getenv("HTTPS_PROXY"), System.getenv("HTTP_PROXY"));
324323
doActionWithIgnoreSSL(request, X509TrustAll.ignoreSSLCerts);
325324

aliyun-java-sdk-core/src/main/java/com/aliyuncs/http/clients/ApacheHttpClient.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import com.aliyuncs.exceptions.ClientException;
44
import com.aliyuncs.http.*;
5+
import com.aliyuncs.utils.EnvHelper;
56
import com.aliyuncs.utils.EnvironmentUtils;
67
import com.aliyuncs.utils.IOUtils;
78
import com.aliyuncs.utils.StringUtils;
@@ -271,16 +272,16 @@ private HttpUriRequest parseToHttpRequest(HttpRequest apiReq) throws IOException
271272
}
272273

273274
private HttpHost calcProxy(HttpRequest apiReq) throws MalformedURLException, ClientException {
274-
boolean needProxy = HttpUtil.needProxy(new URL(apiReq.getSysUrl()).getHost(), clientConfig.getNoProxy(), EnvironmentUtils.getNoProxy());
275+
boolean needProxy = HttpUtil.needProxy(new URL(apiReq.getSysUrl()).getHost(), clientConfig.getNoProxy(), EnvHelper.getenv("NO_PROXY"));
275276
if (!needProxy) {
276277
return null;
277278
}
278279
URL url = new URL(apiReq.getSysUrl());
279280
HttpHost proxy = null;
280281
if ("https".equalsIgnoreCase(url.getProtocol())) {
281-
proxy = HttpUtil.getApacheProxy(clientConfig.getHttpsProxy(), EnvironmentUtils.getHttpsProxy(), apiReq);
282+
proxy = HttpUtil.getApacheProxy(clientConfig.getHttpsProxy(), EnvHelper.getenv("HTTPS_PROXY"), apiReq);
282283
} else {
283-
proxy = HttpUtil.getApacheProxy(clientConfig.getHttpProxy(), EnvironmentUtils.getHttpProxy(), apiReq);
284+
proxy = HttpUtil.getApacheProxy(clientConfig.getHttpProxy(), EnvHelper.getenv("HTTP_PROXY"), apiReq);
284285
}
285286
return proxy;
286287
}

aliyun-java-sdk-core/src/main/java/com/aliyuncs/http/clients/CompatibleUrlConnClient.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import com.aliyuncs.exceptions.ClientException;
44
import com.aliyuncs.http.*;
5+
import com.aliyuncs.utils.EnvHelper;
56
import com.aliyuncs.utils.EnvironmentUtils;
67
import org.apache.http.conn.ssl.DefaultHostnameVerifier;
78
import org.apache.http.conn.ssl.NoopHostnameVerifier;
@@ -165,16 +166,16 @@ private void checkHttpRequest(HttpRequest request) {
165166

166167
private Proxy calcProxy(URL url, HttpRequest request) throws ClientException {
167168
String targetHost = url.getHost();
168-
boolean needProxy = HttpUtil.needProxy(targetHost, clientConfig.getNoProxy(), EnvironmentUtils.getNoProxy());
169+
boolean needProxy = HttpUtil.needProxy(targetHost, clientConfig.getNoProxy(), EnvHelper.getenv("NO_PROXY"));
169170
if (!needProxy) {
170171
return Proxy.NO_PROXY;
171172
}
172173
Proxy proxy;
173174
if ("https".equalsIgnoreCase(url.getProtocol())) {
174-
String httpsProxy = EnvironmentUtils.getHttpsProxy();
175+
String httpsProxy = EnvHelper.getenv("HTTPS_PROXY");
175176
proxy = HttpUtil.getJDKProxy(clientConfig.getHttpsProxy(), httpsProxy, request);
176177
} else {
177-
String httpProxy = EnvironmentUtils.getHttpProxy();
178+
String httpProxy = EnvHelper.getenv("HTTP_PROXY");
178179
proxy = HttpUtil.getJDKProxy(clientConfig.getHttpProxy(), httpProxy, request);
179180
}
180181
return proxy;

aliyun-java-sdk-core/src/main/java/com/aliyuncs/utils/EnvironmentUtils.java

-48
This file was deleted.

aliyun-java-sdk-core/src/test/java/com/aliyuncs/utils/EnvironmentUtilsTest.java

-33
This file was deleted.

0 commit comments

Comments
 (0)