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 44 <modelVersion >4.0.0</modelVersion >
55 <groupId >com.qcloud</groupId >
66 <artifactId >cos_api</artifactId >
7- <version >5.6.244.2 </version >
7+ <version >5.6.244.3 </version >
88 <packaging >jar</packaging >
99 <name >cos-java-sdk</name >
1010 <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)
11831183 * to wrap their code in try/catch blocks and check for this status code if they want to
11841184 * use constraints.
11851185 */
1186- if (cse .getStatusCode () == 412 || cse .getStatusCode () == 304 ) {
1186+ if (( cse .getStatusCode () == 412 && ! clientConfig . isThrow412Directly ()) || ( cse .getStatusCode () == 304 && ! clientConfig . isThrow304Directly ()) ) {
11871187 return null ;
11881188 }
11891189 throw cse ;
Original file line number Diff line number Diff line change @@ -141,6 +141,10 @@ public class ClientConfig {
141141
142142 private boolean addLogDebugHeader = true ;
143143
144+ private boolean throw412Directly = false ;
145+
146+ private boolean throw304Directly = false ;
147+
144148 // 不传入region 用于后续调用List Buckets(获取所有的bucket信息)
145149 public ClientConfig () {
146150 super ();
@@ -517,4 +521,20 @@ public boolean isAddLogDebugHeader() {
517521 public void setAddLogDebugHeader (boolean addLogDebugHeader ) {
518522 this .addLogDebugHeader = addLogDebugHeader ;
519523 }
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+ }
520540}
Original file line number Diff line number Diff line change @@ -832,7 +832,7 @@ private <Y extends CosServiceRequest> void changeEndpointForRetry(CosHttpRequest
832832 for (Header header : httpResponse .getAllHeaders ()) {
833833 if (Objects .equals (header .getName (), Headers .REQUEST_ID )) {
834834 String value = CodecUtils .convertFromIso88591ToUtf8 (header .getValue ());
835- if (!value .isEmpty ()) {
835+ if (value != null && !value .isEmpty ()) {
836836 return ;
837837 }
838838 }
You can’t perform that action at this time.
0 commit comments