Skip to content

Commit 4bb72aa

Browse files
authored
Merge pull request #97 from qixu001/globalization
Globalization
2 parents 724e341 + eaca5e3 commit 4bb72aa

File tree

107 files changed

+2420
-2255
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+2420
-2255
lines changed

src/main/java/com/aliyun/oss/ClientConfiguration.java

Lines changed: 107 additions & 98 deletions
Large diffs are not rendered by default.

src/main/java/com/aliyun/oss/ClientErrorCode.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,37 +22,37 @@
2222
public interface ClientErrorCode {
2323

2424
/**
25-
* 未知错误。
25+
* Unknown error. This means the error is not expected.
2626
*/
2727
static final String UNKNOWN = "Unknown";
2828

2929
/**
30-
* 未知域名。
30+
* Unknown host. This error is returned when a {@link java.net.UnknownHostException} is thrown.
3131
*/
3232
static final String UNKNOWN_HOST = "UnknownHost";
3333

3434
/**
35-
* 远程服务连接超时。
35+
* connection times out.
3636
*/
3737
static final String CONNECTION_TIMEOUT = "ConnectionTimeout";
3838

3939
/**
40-
* 远程服务socket读写超时。
40+
* Socket times out
4141
*/
4242
static final String SOCKET_TIMEOUT = "SocketTimeout";
4343

4444
/**
45-
* 远程服务socket异常。
45+
* Socket exception
4646
*/
4747
static final String SOCKET_EXCEPTION = "SocketException";
4848

4949
/**
50-
* 远程服务拒绝连接。
50+
* Connection is refused by server side.
5151
*/
5252
static final String CONNECTION_REFUSED = "ConnectionRefused";
5353

5454
/**
55-
* 请求输入流不可重复读取。
55+
* The input stream is not repeatable for reading.
5656
*/
5757
static final String NONREPEATABLE_REQUEST = "NonRepeatableRequest";
5858

src/main/java/com/aliyun/oss/ClientException.java

Lines changed: 32 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,20 @@
2121

2222
/**
2323
* <p>
24-
* 表示尝试访问阿里云服务时遇到的异常。
24+
* This exception is the one thrown by the client side when accessing OSS.
2525
* </p>
2626
*
2727
* <p>
28-
* {@link ClientException}表示的则是在向阿里云服务发送请求时出现的错误,以及客户端无法处理返回结果。
29-
* 例如,在发送请求时网络连接不可用,则会抛出{@link ClientException}的异常。
28+
* {@link ClientException} is the class to represent any exception in OSS client side. Generally
29+
* ClientException occurs either before sending the request or after receving the response from OSS server side.
30+
* For example, if the network is broken when it tries to send a request, then the SDK will throw a {@link ClientException}
31+
* instance.
3032
* </p>
3133
*
3234
* <p>
33-
* {@link ServiceException}用于处理阿里云服务返回的错误消息。比如,用于身份验证的Access ID不存在,
34-
* 则会抛出{@link ServiceException}(严格上讲,会是该类的一个继承类。比如,OSSClient会抛出OSSException)。
35-
* 异常中包含了错误代码,用于让调用者进行特定的处理。
36-
* </p>
37-
*
38-
* <p>
39-
* 通常来讲,调用者只需要处理{@link ServiceException}。因为该异常表明请求被服务处理,但处理的结果表明
40-
* 存在错误。异常中包含了细节的信息,特别是错误代码,可以帮助调用者进行处理。
35+
* {@link ServiceException} is converted from error code from OSS response. For example, when OSS tries to authenticate
36+
* a request, if Access ID does not exist, the SDK will throw a {@link ServiceException} or its subclass instance
37+
* with the specific error code, which the caller could handle that with specific logic.
4138
* </p>
4239
*
4340
*/
@@ -50,32 +47,32 @@ public class ClientException extends RuntimeException {
5047
private String errorCode;
5148

5249
/**
53-
* 构造新实例。
50+
* Creates a default instance.
5451
*/
5552
public ClientException() {
5653
super();
5754
}
5855

5956
/**
60-
* 用给定的异常信息构造新实例。
61-
* @param errorMessage 异常信息。
57+
* Creates an instance with error message.
58+
* @param errorMessage Error message.
6259
*/
6360
public ClientException(String errorMessage) {
6461
this(errorMessage, null);
6562
}
6663

6764
/**
68-
* 用表示异常原因的对象构造新实例。
69-
* @param cause 异常原因。
65+
* Creates an instance with an exception
66+
* @param cause An exception.
7067
*/
7168
public ClientException(Throwable cause) {
7269
this(null, cause);
7370
}
7471

7572
/**
76-
* 用异常消息和表示异常原因的对象构造新实例。
77-
* @param errorMessage 异常信息。
78-
* @param cause 异常原因。
73+
* Creates an instance with error message and an exception.
74+
* @param errorMessage Error message.
75+
* @param cause An exception.
7976
*/
8077
public ClientException(String errorMessage, Throwable cause) {
8178
super(null, cause);
@@ -85,21 +82,22 @@ public ClientException(String errorMessage, Throwable cause) {
8582
}
8683

8784
/**
88-
* 用异常消息构造新实例。
89-
* @param errorMessage 异常信息。
90-
* @param errorCode 错误码。
91-
* @param requestId 请求编号。
85+
* Creates an instance with error message, error code, request Id
86+
* @param errorMessage Error message.
87+
* @param errorCode Error code, which typically is from a set of predefined errors. The handler code could do action
88+
* based on this.
89+
* @param requestId Request Id.
9290
*/
9391
public ClientException(String errorMessage, String errorCode, String requestId) {
9492
this(errorMessage, errorCode, requestId, null);
9593
}
9694

9795
/**
98-
* 用异常消息和表示异常原因的对象构造新实例。
99-
* @param errorMessage 异常信息。
100-
* @param errorCode 错误码。
101-
* @param requestId 请求编号。
102-
* @param cause 异常原因。
96+
* Creates an instance with error message, error code, request Id and an exception.
97+
* @param errorMessage Error message.
98+
* @param errorCode Error code.
99+
* @param requestId Request Id.
100+
* @param cause An exception.
103101
*/
104102
public ClientException(String errorMessage, String errorCode, String requestId, Throwable cause) {
105103
this(errorMessage, cause);
@@ -108,24 +106,24 @@ public ClientException(String errorMessage, String errorCode, String requestId,
108106
}
109107

110108
/**
111-
* 获取异常信息。
112-
* @return 异常信息。
109+
* Get error message.
110+
* @return Error message in string.
113111
*/
114112
public String getErrorMessage() {
115113
return errorMessage;
116114
}
117115

118116
/**
119-
* 获取异常的错误码
120-
* @return 异常错误码
117+
* Get error code.
118+
* @return Error code.
121119
*/
122120
public String getErrorCode() {
123121
return errorCode;
124122
}
125123

126124
/**
127-
* 获取本次异常的 RequestId
128-
* @return 本次异常的 RequestId
125+
* Gets request id.
126+
* @return The request Id.
129127
*/
130128
public String getRequestId() {
131129
return requestId;

src/main/java/com/aliyun/oss/HttpMethod.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,36 +20,36 @@
2020
package com.aliyun.oss;
2121

2222
/**
23-
* 表示HTTP的请求方法。
23+
* Http Methods
2424
*/
2525
public enum HttpMethod {
2626
/**
27-
* DELETE方法。
27+
* HTTP DELETE.
2828
*/
2929
DELETE,
3030

3131
/**
32-
* GET方法。
32+
* HTTP GET
3333
*/
3434
GET,
3535

3636
/**
37-
* HEAD方法。
37+
* HTTP HEAD
3838
*/
3939
HEAD,
4040

4141
/**
42-
* POST方法。
42+
* HTTP POST
4343
*/
4444
POST,
4545

4646
/**
47-
* PUT方法。
47+
* HTTP PUT
4848
*/
4949
PUT,
5050

5151
/**
52-
* OPTION方法。
52+
* HTTP OPTION
5353
*/
5454
OPTIONS
5555
}

src/main/java/com/aliyun/oss/InconsistentException.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,17 @@
2121

2222
/**
2323
* <p>
24-
* 表示OSS端的数据与SDK端的数据不一致。
24+
* This exception indicates the checksum returned from Server side is not same as the one calculated from client side.
2525
* </p>
2626
*
2727
*
2828
* <p>
29-
* 通常来讲,调用者需要处理{@link InconsistentException}。因为该异常表明请求被服务处理,
30-
* 上传操作已经成功,但是OSS端的数据与SDK端不一致。调用者需要上传上传的文件然后重新删除。
29+
* Generally speaking, the caller needs to handle the {@link InconsistentException}, because it means the data uploaded
30+
* or downloaded is not same as its source. Re-upload or re-download is needed to correct the data.
3131
* </p>
3232
*
3333
* <p>
34-
* 抛出该异常的操作包括putObject、appendObject、uploadPart、uploadFile等上传操作,
35-
* getObject下载操作的数据一致性,调用者需要在数据流读取结束后校验,即比较OSS端与SDK端的数据校验和。
34+
* Operations that could throw this exception include putObject, appendObject, uploadPart, uploadFile, getObject, etc.
3635
* </p>
3736
*
3837
*/

0 commit comments

Comments
 (0)