Skip to content

Commit 6e08d06

Browse files
committed
Format code
1 parent cd8e46e commit 6e08d06

File tree

214 files changed

+7840
-7418
lines changed

Some content is hidden

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

214 files changed

+7840
-7418
lines changed

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

Lines changed: 157 additions & 83 deletions
Large diffs are not rendered by default.

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

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

2222
public interface ClientErrorCode {
23-
23+
2424
/**
2525
* Unknown error. This means the error is not expected.
2626
*/
27-
static final String UNKNOWN = "Unknown";
28-
27+
static final String UNKNOWN = "Unknown";
28+
2929
/**
30-
* Unknown host. This error is returned when a {@link java.net.UnknownHostException} is thrown.
30+
* Unknown host. This error is returned when a
31+
* {@link java.net.UnknownHostException} is thrown.
3132
*/
3233
static final String UNKNOWN_HOST = "UnknownHost";
33-
34+
3435
/**
3536
* connection times out.
3637
*/
3738
static final String CONNECTION_TIMEOUT = "ConnectionTimeout";
38-
39+
3940
/**
4041
* Socket times out
4142
*/
4243
static final String SOCKET_TIMEOUT = "SocketTimeout";
43-
44+
4445
/**
4546
* Socket exception
4647
*/
4748
static final String SOCKET_EXCEPTION = "SocketException";
48-
49+
4950
/**
5051
* Connection is refused by server side.
5152
*/
5253
static final String CONNECTION_REFUSED = "ConnectionRefused";
53-
54+
5455
/**
5556
* The input stream is not repeatable for reading.
5657
*/
5758
static final String NONREPEATABLE_REQUEST = "NonRepeatableRequest";
58-
59+
5960
}

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

Lines changed: 52 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -25,27 +25,30 @@
2525
* </p>
2626
*
2727
* <p>
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.
28+
* {@link ClientException} is the class to represent any exception in OSS client
29+
* side. Generally ClientException occurs either before sending the request or
30+
* after receving the response from OSS server side. For example, if the network
31+
* is broken when it tries to send a request, then the SDK will throw a
32+
* {@link ClientException} instance.
3233
* </p>
3334
*
3435
* <p>
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.
36+
* {@link ServiceException} is converted from error code from OSS response. For
37+
* example, when OSS tries to authenticate a request, if Access ID does not
38+
* exist, the SDK will throw a {@link ServiceException} or its subclass instance
39+
* with the specific error code, which the caller could handle that with
40+
* specific logic.
3841
* </p>
3942
*
4043
*/
4144
public class ClientException extends RuntimeException {
42-
45+
4346
private static final long serialVersionUID = 1870835486798448798L;
44-
47+
4548
private String errorMessage;
4649
private String requestId;
4750
private String errorCode;
48-
51+
4952
/**
5053
* Creates a default instance.
5154
*/
@@ -55,49 +58,66 @@ public ClientException() {
5558

5659
/**
5760
* Creates an instance with error message.
58-
* @param errorMessage Error message.
61+
*
62+
* @param errorMessage
63+
* Error message.
5964
*/
6065
public ClientException(String errorMessage) {
6166
this(errorMessage, null);
6267
}
6368

6469
/**
6570
* Creates an instance with an exception
66-
* @param cause An exception.
71+
*
72+
* @param cause
73+
* An exception.
6774
*/
6875
public ClientException(Throwable cause) {
6976
this(null, cause);
7077
}
71-
78+
7279
/**
7380
* Creates an instance with error message and an exception.
74-
* @param errorMessage Error message.
75-
* @param cause An exception.
81+
*
82+
* @param errorMessage
83+
* Error message.
84+
* @param cause
85+
* An exception.
7686
*/
7787
public ClientException(String errorMessage, Throwable cause) {
7888
super(null, cause);
7989
this.errorMessage = errorMessage;
8090
this.errorCode = ClientErrorCode.UNKNOWN;
8191
this.requestId = "Unknown";
8292
}
83-
93+
8494
/**
8595
* 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.
96+
*
97+
* @param errorMessage
98+
* Error message.
99+
* @param errorCode
100+
* Error code, which typically is from a set of predefined
101+
* errors. The handler code could do action based on this.
102+
* @param requestId
103+
* Request Id.
90104
*/
91105
public ClientException(String errorMessage, String errorCode, String requestId) {
92106
this(errorMessage, errorCode, requestId, null);
93107
}
94108

95109
/**
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.
110+
* Creates an instance with error message, error code, request Id and an
111+
* exception.
112+
*
113+
* @param errorMessage
114+
* Error message.
115+
* @param errorCode
116+
* Error code.
117+
* @param requestId
118+
* Request Id.
119+
* @param cause
120+
* An exception.
101121
*/
102122
public ClientException(String errorMessage, String errorCode, String requestId, Throwable cause) {
103123
this(errorMessage, cause);
@@ -107,14 +127,16 @@ public ClientException(String errorMessage, String errorCode, String requestId,
107127

108128
/**
109129
* Get error message.
130+
*
110131
* @return Error message in string.
111132
*/
112133
public String getErrorMessage() {
113134
return errorMessage;
114135
}
115-
136+
116137
/**
117138
* Get error code.
139+
*
118140
* @return Error code.
119141
*/
120142
public String getErrorCode() {
@@ -123,16 +145,16 @@ public String getErrorCode() {
123145

124146
/**
125147
* Gets request id.
148+
*
126149
* @return The request Id.
127150
*/
128151
public String getRequestId() {
129-
return requestId;
152+
return requestId;
130153
}
131154

132155
@Override
133156
public String getMessage() {
134-
return getErrorMessage()
135-
+ "\n[ErrorCode]: " + errorCode != null ? errorCode : ""
136-
+ "\n[RequestId]: " + requestId != null ? requestId : "";
157+
return getErrorMessage() + "\n[ErrorCode]: " + errorCode != null ? errorCode
158+
: "" + "\n[RequestId]: " + requestId != null ? requestId : "";
137159
}
138160
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public enum HttpMethod {
4747
* HTTP PUT
4848
*/
4949
PUT,
50-
50+
5151
/**
5252
* HTTP OPTION
5353
*/

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

Lines changed: 40 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -21,64 +21,67 @@
2121

2222
/**
2323
* <p>
24-
* This exception indicates the checksum returned from Server side is not same as the one calculated from client side.
24+
* This exception indicates the checksum returned from Server side is not same
25+
* as the one calculated from client side.
2526
* </p>
2627
*
2728
*
2829
* <p>
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.
30+
* Generally speaking, the caller needs to handle the
31+
* {@link InconsistentException}, because it means the data uploaded or
32+
* downloaded is not same as its source. Re-upload or re-download is needed to
33+
* correct the data.
3134
* </p>
3235
*
3336
* <p>
34-
* Operations that could throw this exception include putObject, appendObject, uploadPart, uploadFile, getObject, etc.
37+
* Operations that could throw this exception include putObject, appendObject,
38+
* uploadPart, uploadFile, getObject, etc.
3539
* </p>
3640
*
3741
*/
3842
public class InconsistentException extends RuntimeException {
3943

40-
private static final long serialVersionUID = 2140587868503948665L;
44+
private static final long serialVersionUID = 2140587868503948665L;
4145

42-
private Long clientChecksum;
46+
private Long clientChecksum;
4347
private Long serverChecksum;
4448
private String requestId;
4549

46-
public InconsistentException(Long clientChecksum, Long serverChecksum, String requestId) {
47-
super();
48-
this.clientChecksum = clientChecksum;
49-
this.serverChecksum = serverChecksum;
50-
this.requestId = requestId;
51-
}
52-
53-
public Long getClientChecksum() {
54-
return clientChecksum;
55-
}
50+
public InconsistentException(Long clientChecksum, Long serverChecksum, String requestId) {
51+
super();
52+
this.clientChecksum = clientChecksum;
53+
this.serverChecksum = serverChecksum;
54+
this.requestId = requestId;
55+
}
56+
57+
public Long getClientChecksum() {
58+
return clientChecksum;
59+
}
60+
61+
public void setClientChecksum(Long clientChecksum) {
62+
this.clientChecksum = clientChecksum;
63+
}
5664

57-
public void setClientChecksum(Long clientChecksum) {
58-
this.clientChecksum = clientChecksum;
59-
}
65+
public Long getServerChecksum() {
66+
return serverChecksum;
67+
}
6068

61-
public Long getServerChecksum() {
62-
return serverChecksum;
63-
}
69+
public void setServerChecksum(Long serverChecksum) {
70+
this.serverChecksum = serverChecksum;
71+
}
6472

65-
public void setServerChecksum(Long serverChecksum) {
66-
this.serverChecksum = serverChecksum;
67-
}
73+
public String getRequestId() {
74+
return requestId;
75+
}
6876

69-
public String getRequestId() {
70-
return requestId;
71-
}
77+
public void setRequestId(String requestId) {
78+
this.requestId = requestId;
79+
}
7280

73-
public void setRequestId(String requestId) {
74-
this.requestId = requestId;
75-
}
76-
77-
@Override
81+
@Override
7882
public String getMessage() {
79-
return "InconsistentException " + "\n[RequestId]: " + getRequestId()
80-
+ "\n[ClientChecksum]: " + getClientChecksum()
81-
+ "\n[ServerChecksum]: " + getServerChecksum();
83+
return "InconsistentException " + "\n[RequestId]: " + getRequestId() + "\n[ClientChecksum]: "
84+
+ getClientChecksum() + "\n[ServerChecksum]: " + getServerChecksum();
8285
}
83-
86+
8487
}

0 commit comments

Comments
 (0)