File tree Expand file tree Collapse file tree 4 files changed +23
-3
lines changed
src/main/java/com/qcloud/cos Expand file tree Collapse file tree 4 files changed +23
-3
lines changed Original file line number Diff line number Diff line change 4
4
<modelVersion >4.0.0</modelVersion >
5
5
<groupId >com.qcloud</groupId >
6
6
<artifactId >cos_api</artifactId >
7
- <version >5.6.244.2 </version >
7
+ <version >5.6.244.3 </version >
8
8
<packaging >jar</packaging >
9
9
<name >cos-java-sdk</name >
10
10
<description >java sdk for qcloud cos</description >
Original file line number Diff line number Diff line change @@ -1183,7 +1183,7 @@ public COSObject getObject(GetObjectRequest getObjectRequest)
1183
1183
* to wrap their code in try/catch blocks and check for this status code if they want to
1184
1184
* use constraints.
1185
1185
*/
1186
- if (cse .getStatusCode () == 412 || cse .getStatusCode () == 304 ) {
1186
+ if (( cse .getStatusCode () == 412 && ! clientConfig . isThrow412Directly ()) || ( cse .getStatusCode () == 304 && ! clientConfig . isThrow304Directly ()) ) {
1187
1187
return null ;
1188
1188
}
1189
1189
throw cse ;
Original file line number Diff line number Diff line change @@ -141,6 +141,10 @@ public class ClientConfig {
141
141
142
142
private boolean addLogDebugHeader = true ;
143
143
144
+ private boolean throw412Directly = false ;
145
+
146
+ private boolean throw304Directly = false ;
147
+
144
148
// 不传入region 用于后续调用List Buckets(获取所有的bucket信息)
145
149
public ClientConfig () {
146
150
super ();
@@ -517,4 +521,20 @@ public boolean isAddLogDebugHeader() {
517
521
public void setAddLogDebugHeader (boolean addLogDebugHeader ) {
518
522
this .addLogDebugHeader = addLogDebugHeader ;
519
523
}
524
+
525
+ public boolean isThrow412Directly () {
526
+ return throw412Directly ;
527
+ }
528
+
529
+ public void setThrow412Directly (boolean throw412Directly ) {
530
+ this .throw412Directly = throw412Directly ;
531
+ }
532
+
533
+ public boolean isThrow304Directly () {
534
+ return throw304Directly ;
535
+ }
536
+
537
+ public void setThrow304Directly (boolean throw304Directly ) {
538
+ this .throw304Directly = throw304Directly ;
539
+ }
520
540
}
Original file line number Diff line number Diff line change @@ -832,7 +832,7 @@ private <Y extends CosServiceRequest> void changeEndpointForRetry(CosHttpRequest
832
832
for (Header header : httpResponse .getAllHeaders ()) {
833
833
if (Objects .equals (header .getName (), Headers .REQUEST_ID )) {
834
834
String value = CodecUtils .convertFromIso88591ToUtf8 (header .getValue ());
835
- if (!value .isEmpty ()) {
835
+ if (value != null && !value .isEmpty ()) {
836
836
return ;
837
837
}
838
838
}
You can’t perform that action at this time.
0 commit comments