Skip to content

Commit 80f53f7

Browse files
authored
Merge pull request #105 from aliyun/fix-req-id
Fix request id
2 parents 4bb72aa + 49f4515 commit 80f53f7

Some content is hidden

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

54 files changed

+286
-58
lines changed

.travis.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
language: java
22
jdk:
3-
- openjdk6
43
- openjdk7
5-
- oraclejdk7
64
- oraclejdk8
5+
- oraclejdk9
76
script:
87
- mvn install -DskipTests=true
98
env:

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ The recommended way to use the Aliyun OSS SDK for Java in your project is to con
2424
<dependency>
2525
<groupId>com.aliyun.oss</groupId>
2626
<artifactId>aliyun-sdk-oss</artifactId>
27-
<version>2.8.1</version>
27+
<version>2.8.2</version>
2828
</dependency>
2929
```
3030

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
<groupId>com.aliyun.oss</groupId>
1313
<artifactId>aliyun-sdk-oss</artifactId>
14-
<version>2.8.1</version>
14+
<version>2.8.2</version>
1515
<packaging>jar</packaging>
1616
<name>Aliyun OSS SDK for Java</name>
1717
<description>The Aliyun OSS SDK for Java used for accessing Aliyun Object Storage Service</description>

src/main/java/com/aliyun/oss/internal/OSSBucketOperation.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@
8585
import com.aliyun.oss.OSSException;
8686
import com.aliyun.oss.common.auth.CredentialsProvider;
8787
import com.aliyun.oss.common.comm.RequestMessage;
88+
import com.aliyun.oss.common.comm.ResponseMessage;
8889
import com.aliyun.oss.common.comm.ServiceClient;
8990
import com.aliyun.oss.common.utils.BinaryUtil;
9091
import com.aliyun.oss.common.utils.HttpHeaders;
@@ -161,9 +162,9 @@ public Bucket createBucket(CreateBucketRequest createBucketRequest)
161162
.setInputStreamWithLength(createBucketRequestMarshaller.marshall(createBucketRequest))
162163
.setOriginalRequest(createBucketRequest)
163164
.build();
164-
165-
doOperation(request, emptyResponseParser, bucketName, null);
166-
return new Bucket(bucketName);
165+
166+
ResponseMessage result = doOperation(request, emptyResponseParser, bucketName, null);
167+
return new Bucket(bucketName , result.getRequestId());
167168
}
168169

169170
/**

src/main/java/com/aliyun/oss/internal/ResponseParsers.java

Lines changed: 63 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,9 @@ public static final class ListBucketResponseParser implements ResponseParser<Buc
188188
public BucketList parse(ResponseMessage response)
189189
throws ResponseParseException {
190190
try {
191-
return parseListBucket(response.getContent());
191+
BucketList result = parseListBucket(response.getContent());
192+
result.setRequestId(response.getRequestId());
193+
return result;
192194
} finally {
193195
safeCloseResponse(response);
194196
}
@@ -213,7 +215,9 @@ public static final class GetBucketRefererResponseParser implements ResponsePars
213215
public BucketReferer parse(ResponseMessage response)
214216
throws ResponseParseException {
215217
try {
216-
return parseGetBucketReferer(response.getContent());
218+
BucketReferer result = parseGetBucketReferer(response.getContent());
219+
result.setRequestId(response.getRequestId());
220+
return result;
217221
} finally {
218222
safeCloseResponse(response);
219223
}
@@ -227,7 +231,9 @@ public static final class GetBucketAclResponseParser implements ResponseParser<A
227231
public AccessControlList parse(ResponseMessage response)
228232
throws ResponseParseException {
229233
try {
230-
return parseGetBucketAcl(response.getContent());
234+
AccessControlList result = parseGetBucketAcl(response.getContent());
235+
result.setRequestId(response.getRequestId());
236+
return result;
231237
} finally {
232238
safeCloseResponse(response);
233239
}
@@ -255,7 +261,9 @@ public static final class GetBucketLoggingResponseParser implements ResponsePars
255261
public BucketLoggingResult parse(ResponseMessage response)
256262
throws ResponseParseException {
257263
try {
258-
return parseBucketLogging(response.getContent());
264+
BucketLoggingResult result = parseBucketLogging(response.getContent());
265+
result.setRequestId(response.getRequestId());
266+
return result;
259267
} finally {
260268
safeCloseResponse(response);
261269
}
@@ -293,7 +301,9 @@ public static final class GetBucketImageProcessConfResponseParser implements Res
293301
public BucketProcess parse(ResponseMessage response)
294302
throws ResponseParseException {
295303
try {
296-
return parseGetBucketImageProcessConf(response.getContent());
304+
BucketProcess result = parseGetBucketImageProcessConf(response.getContent());
305+
result.setRequestId(response.getRequestId());
306+
return result;
297307
} finally {
298308
safeCloseResponse(response);
299309
}
@@ -307,7 +317,9 @@ public static final class GetBucketWebsiteResponseParser implements ResponsePars
307317
public BucketWebsiteResult parse(ResponseMessage response)
308318
throws ResponseParseException {
309319
try {
310-
return parseBucketWebsite(response.getContent());
320+
BucketWebsiteResult result = parseBucketWebsite(response.getContent());
321+
result.setRequestId(response.getRequestId());
322+
return result;
311323
} finally {
312324
safeCloseResponse(response);
313325
}
@@ -349,7 +361,9 @@ public static final class GetBucketInfoResponseParser implements ResponseParser<
349361
public BucketInfo parse(ResponseMessage response)
350362
throws ResponseParseException {
351363
try {
352-
return parseGetBucketInfo(response.getContent());
364+
BucketInfo result = parseGetBucketInfo(response.getContent());
365+
result.setRequestId(response.getRequestId());
366+
return result;
353367
} finally {
354368
safeCloseResponse(response);
355369
}
@@ -363,7 +377,9 @@ public static final class GetBucketStatResponseParser implements ResponseParser<
363377
public BucketStat parse(ResponseMessage response)
364378
throws ResponseParseException {
365379
try {
366-
return parseGetBucketStat(response.getContent());
380+
BucketStat result = parseGetBucketStat(response.getContent());
381+
result.setRequestId(response.getRequestId());
382+
return result;
367383
} finally {
368384
safeCloseResponse(response);
369385
}
@@ -377,7 +393,9 @@ public static final class GetBucketQosResponseParser implements ResponseParser<U
377393
public UserQos parse(ResponseMessage response)
378394
throws ResponseParseException {
379395
try {
380-
return parseGetUserQos(response.getContent());
396+
UserQos result = parseGetUserQos(response.getContent());
397+
result.setRequestId(response.getRequestId());
398+
return result;
381399
} finally {
382400
safeCloseResponse(response);
383401
}
@@ -391,7 +409,9 @@ public static final class CreateLiveChannelResponseParser implements ResponsePar
391409
public CreateLiveChannelResult parse(ResponseMessage response)
392410
throws ResponseParseException {
393411
try {
394-
return parseCreateLiveChannel(response.getContent());
412+
CreateLiveChannelResult result = parseCreateLiveChannel(response.getContent());
413+
result.setRequestId(response.getRequestId());
414+
return result;
395415
} finally {
396416
safeCloseResponse(response);
397417
}
@@ -405,7 +425,9 @@ public static final class GetLiveChannelInfoResponseParser implements ResponsePa
405425
public LiveChannelInfo parse(ResponseMessage response)
406426
throws ResponseParseException {
407427
try {
408-
return parseGetLiveChannelInfo(response.getContent());
428+
LiveChannelInfo result = parseGetLiveChannelInfo(response.getContent());
429+
result.setRequestId(response.getRequestId());
430+
return result;
409431
} finally {
410432
safeCloseResponse(response);
411433
}
@@ -419,7 +441,9 @@ public static final class GetLiveChannelStatResponseParser implements ResponsePa
419441
public LiveChannelStat parse(ResponseMessage response)
420442
throws ResponseParseException {
421443
try {
422-
return parseGetLiveChannelStat(response.getContent());
444+
LiveChannelStat result = parseGetLiveChannelStat(response.getContent());
445+
result.setRequestId(response.getRequestId());
446+
return result;
423447
} finally {
424448
safeCloseResponse(response);
425449
}
@@ -475,7 +499,9 @@ public static final class GetBucketTaggingResponseParser implements ResponsePars
475499
public TagSet parse(ResponseMessage response)
476500
throws ResponseParseException {
477501
try {
478-
return parseGetBucketTagging(response.getContent());
502+
TagSet result = parseGetBucketTagging(response.getContent());
503+
result.setRequestId(response.getRequestId());
504+
return result;
479505
} finally {
480506
safeCloseResponse(response);
481507
}
@@ -503,7 +529,9 @@ public static final class GetBucketReplicationProgressResponseParser implements
503529
public BucketReplicationProgress parse(ResponseMessage response)
504530
throws ResponseParseException {
505531
try {
506-
return parseGetBucketReplicationProgress(response.getContent());
532+
BucketReplicationProgress result = parseGetBucketReplicationProgress(response.getContent());
533+
result.setRequestId(response.getRequestId());
534+
return result;
507535
} finally {
508536
safeCloseResponse(response);
509537
}
@@ -531,7 +559,9 @@ public static final class ListObjectsReponseParser implements ResponseParser<Obj
531559
public ObjectListing parse(ResponseMessage response)
532560
throws ResponseParseException {
533561
try {
534-
return parseListObjects(response.getContent());
562+
ObjectListing result = parseListObjects(response.getContent());
563+
result.setRequestId(response.getRequestId());
564+
return result;
535565
} finally {
536566
safeCloseResponse(response);
537567
}
@@ -656,7 +686,9 @@ public static final class GetObjectAclResponseParser implements ResponseParser<O
656686
public ObjectAcl parse(ResponseMessage response)
657687
throws ResponseParseException {
658688
try {
659-
return parseGetObjectAcl(response.getContent());
689+
ObjectAcl result = parseGetObjectAcl(response.getContent());
690+
result.setRequestId(response.getRequestId());
691+
return result;
660692
} finally {
661693
safeCloseResponse(response);
662694
}
@@ -814,7 +846,9 @@ public static final class ListMultipartUploadsResponseParser implements Response
814846
public MultipartUploadListing parse(ResponseMessage response)
815847
throws ResponseParseException {
816848
try {
817-
return parseListMultipartUploads(response.getContent());
849+
MultipartUploadListing result = parseListMultipartUploads(response.getContent());
850+
result.setRequestId(response.getRequestId());
851+
return result;
818852
} finally {
819853
safeCloseResponse(response);
820854
}
@@ -828,7 +862,9 @@ public static final class ListPartsResponseParser implements ResponseParser<Part
828862
public PartListing parse(ResponseMessage response)
829863
throws ResponseParseException {
830864
try {
831-
return parseListParts(response.getContent());
865+
PartListing result = parseListParts(response.getContent());
866+
result.setRequestId(response.getRequestId());
867+
return result;
832868
} finally {
833869
safeCloseResponse(response);
834870
}
@@ -866,7 +902,9 @@ public static final class GetSymbolicLinkResponseParser implements ResponseParse
866902
public OSSSymlink parse(ResponseMessage response)
867903
throws ResponseParseException {
868904
try {
869-
return parseSymbolicLink(response);
905+
OSSSymlink result = parseSymbolicLink(response);
906+
result.setRequestId(response.getRequestId());
907+
return result;
870908
} finally {
871909
OSSUtils.mandatoryCloseResponse(response);
872910
}
@@ -880,7 +918,9 @@ public static final class GetUdfInfoResponseParser implements ResponseParser<Udf
880918
public UdfInfo parse(ResponseMessage response)
881919
throws ResponseParseException {
882920
try {
883-
return parseGetUdfInfo(response.getContent());
921+
UdfInfo result = parseGetUdfInfo(response.getContent());
922+
result.setRequestId(response.getRequestId());
923+
return result;
884924
} finally {
885925
OSSUtils.mandatoryCloseResponse(response);
886926
}
@@ -922,7 +962,9 @@ public static final class GetUdfApplicationInfoResponseParser implements Respons
922962
public UdfApplicationInfo parse(ResponseMessage response)
923963
throws ResponseParseException {
924964
try {
925-
return parseGetUdfApplicationInfo(response.getContent());
965+
UdfApplicationInfo result = parseGetUdfApplicationInfo(response.getContent());
966+
result.setRequestId(response.getRequestId());
967+
return result;
926968
} finally {
927969
safeCloseResponse(response);
928970
}

src/main/java/com/aliyun/oss/model/AccessControlList.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
* The class encapsulates the access control list (ACL) information of OSS.
2929
* It includes an owner and a group of <{@link Grantee},{@link Permission}> pair.
3030
* */
31-
public class AccessControlList implements Serializable {
31+
public class AccessControlList extends GenericResult implements Serializable {
3232

3333
private static final long serialVersionUID = 211267925081748283L;
3434

src/main/java/com/aliyun/oss/model/Bucket.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
* </ul>
3838
* </p>
3939
*/
40-
public class Bucket {
40+
public class Bucket extends GenericResult {
4141

4242
// Bucket name
4343
private String name;
@@ -73,6 +73,11 @@ public Bucket() { }
7373
public Bucket(String name) {
7474
this.name = name;
7575
}
76+
77+
public Bucket(String name, String requestId){
78+
setName(name);
79+
setRequestId(requestId);
80+
}
7681

7782
/**
7883
* The override of toString(). Returns the bucket name, creation date, owner and location, with optional storage class.

src/main/java/com/aliyun/oss/model/BucketInfo.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
/**
2626
* Bucket info
2727
*/
28-
public class BucketInfo {
28+
public class BucketInfo extends GenericResult {
2929
public Bucket getBucket() {
3030
return this.bucket;
3131
}

src/main/java/com/aliyun/oss/model/BucketList.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import java.util.ArrayList;
2323
import java.util.List;
2424

25-
public class BucketList {
25+
public class BucketList extends GenericResult {
2626

2727
private List<Bucket> buckets = new ArrayList<Bucket>();
2828

src/main/java/com/aliyun/oss/model/BucketLoggingResult.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
package com.aliyun.oss.model;
2121

22-
public class BucketLoggingResult {
22+
public class BucketLoggingResult extends GenericResult {
2323
private String targetBucket;
2424
private String targetPrefix;
2525

0 commit comments

Comments
 (0)