Skip to content

Commit c87a032

Browse files
committed
modify core
1 parent c0f29f8 commit c87a032

File tree

4 files changed

+14
-8
lines changed

4 files changed

+14
-8
lines changed

aliyun-java-sdk-core/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<groupId>com.aliyun</groupId>
44
<artifactId>aliyun-java-sdk-core</artifactId>
55
<packaging>jar</packaging>
6-
<version>3.0.10</version>
6+
<version>3.1.1</version>
77
<name>aliyun-java-sdk-core</name>
88
<url>http://www.aliyun.com</url>
99
<description>Aliyun Open API SDK for Java

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ public <T extends AcsResponse> HttpResponse doAction(AcsRequest<T> request,
204204
}catch (SocketTimeoutException exp){
205205
throw new ClientException("SDK.ServerUnreachable","SocketTimeoutException has occurred on a socket read or accept.");
206206
}catch (IOException exp) {
207-
throw new ClientException("SDK.ServerUnreachable", "Speicified endpoint or uri is not valid.");
207+
throw new ClientException("SDK.ServerUnreachable", "Server unreachable: " + exp.toString());
208208
} catch (NoSuchAlgorithmException exp) {
209209
throw new ClientException("SDK.InvalidMD5Algorithm", "MD5 hash is not supported by client side.");
210210
}

aliyun-java-sdk-core/src/main/java/com/aliyuncs/regions/DescribeEndpointServiceImpl.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,10 @@ public DescribeEndpointResponse describeEndpoint(String regionId, String service
3737
request.setRegionId(locationConfig.getRegionId());
3838
request.setLocationProduct(serviceCode);
3939
request.setSecurityToken(credential.getSecurityToken());
40-
request.setEndpointType(DEFAULT_ENDPOINT_TYPE);
40+
if (isEmpty(endpointType)) {
41+
endpointType = DEFAULT_ENDPOINT_TYPE;
42+
}
43+
request.setEndpointType(endpointType);
4144

4245
ISigner signer = ShaHmac1Singleton.INSTANCE.getInstance();
4346
ProductDomain domain = new ProductDomain(locationConfig.getProduct(), locationConfig.getEndpoint());
@@ -47,7 +50,7 @@ public DescribeEndpointResponse describeEndpoint(String regionId, String service
4750
HttpResponse httpResponse = HttpResponse.getResponse(httpRequest);
4851
if (httpResponse.isSuccess()) {
4952
String data = new String(httpResponse.getContent(), "utf-8");
50-
DescribeEndpointResponse response = getEndpointResponse(data);
53+
DescribeEndpointResponse response = getEndpointResponse(data, endpointType);
5154
if (response == null || isEmpty(response.getEndpoint())) {
5255
return null;
5356
}
@@ -68,16 +71,16 @@ public DescribeEndpointResponse describeEndpoint(String regionId, String service
6871
}
6972
}
7073

71-
private DescribeEndpointResponse getEndpointResponse(String data) throws ClientException {
74+
private DescribeEndpointResponse getEndpointResponse(String data, String endpointType) throws ClientException {
7275
Reader reader = ReaderFactory.createInstance(FormatType.JSON);
7376
UnmarshallerContext context = new UnmarshallerContext();
7477

7578
context.setResponseMap(reader.read(data, "DescribeEndpointsResponse"));
7679

7780
int endpointsLength = context.lengthValue("DescribeEndpointsResponse.Endpoints.Length");
7881
for (int i = 0; i < endpointsLength; i++) {
79-
if (DEFAULT_ENDPOINT_TYPE.equalsIgnoreCase(context.stringValue("DescribeEndpointsResponse.Endpoints[" + i
80-
+ "].Type"))) {
82+
if (endpointType.equalsIgnoreCase(context
83+
.stringValue("DescribeEndpointsResponse.Endpoints[" + i + "].Type"))) {
8184
DescribeEndpointResponse response = new DescribeEndpointResponse();
8285

8386
response.setRequestId(context.stringValue("DescribeEndpointsResponse.RequestId"));

aliyun-java-sdk-core/src/main/java/com/aliyuncs/regions/LocationConfig.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
package com.aliyuncs.regions;
22

3-
public final class LocationConfig {
3+
public final class LocationConfig {
4+
public static final String LOCATION_INNER_ENDPOINT = "location.aliyuncs.com";
5+
public static final String LOCATION_INNER_PRODUCT = "Location";
6+
47
private String regionId = "cn-hangzhou";
58
private String product = "Location";
69
private String endpoint = "location.aliyuncs.com";

0 commit comments

Comments
 (0)