File tree Expand file tree Collapse file tree 5 files changed +18
-21
lines changed
QCloudFoundation/foundation
src/main/java/com/tencent/qcloud/core Expand file tree Collapse file tree 5 files changed +18
-21
lines changed Original file line number Diff line number Diff line change @@ -7,8 +7,8 @@ android {
77 minSdkVersion 15
88 targetSdkVersion 28
99
10- versionCode 10576
11- versionName " 1.5.75 "
10+ versionCode 10577
11+ versionName " 1.5.76 "
1212
1313 testInstrumentationRunner ' androidx.test.runner.AndroidJUnitRunner'
1414
Original file line number Diff line number Diff line change @@ -78,6 +78,14 @@ public final String string() throws IOException {
7878 return response .body () == null ? null : response .body ().string ();
7979 }
8080
81+ public String host () {
82+ try {
83+ return response .request ().url ().host ();
84+ } catch (Exception e ) {
85+ return null ;
86+ }
87+ }
88+
8189 public final boolean isSuccessful () {
8290 return response != null && response .isSuccessful ();
8391 }
Original file line number Diff line number Diff line change @@ -458,6 +458,10 @@ private boolean isRecoverable(IOException e) {
458458 return false ;
459459 }
460460
461+ if (e .getCause () instanceof QCloudServiceException ) {
462+ return ((QCloudServiceException ) e .getCause ()).getStatusCode () >= 500 ;
463+ }
464+
461465 // An example of one we might want to retry with a different route is a problem connecting to a
462466 // proxy and would manifest as a standard IOException. Unless it is one we know we should not
463467 // retry, we return true and try a new route.
Original file line number Diff line number Diff line change @@ -458,6 +458,10 @@ private boolean isRecoverable(IOException e) {
458458 return false ;
459459 }
460460
461+ if (e .getCause () instanceof QCloudServiceException ) {
462+ return ((QCloudServiceException ) e .getCause ()).getStatusCode () >= 500 ;
463+ }
464+
461465 // An example of one we might want to retry with a different route is a problem connecting to a
462466 // proxy and would manifest as a standard IOException. Unless it is one we know we should not
463467 // retry, we return true and try a new route.
Original file line number Diff line number Diff line change @@ -165,25 +165,6 @@ public static String urlDecodeString(String source) {
165165 return null ;
166166 }
167167
168- // 先替换加号为特殊编码,再解码,最后还原加号
169- public static String decodePreservingPlus (String source ) {
170- // 1. 将原始字符串中的加号临时替换为"%2B"(加号的URL编码)
171- String temp = source .replace ("+" , "%2B" );
172-
173- String decoded ;
174- try {
175- // 2. 使用URLDecoder进行标准解码
176- decoded = URLDecoder .decode (temp , "UTF-8" );
177- } catch (UnsupportedEncodingException e ) {
178- e .printStackTrace ();
179- return null ;
180- }
181-
182- // 3. 将临时替换的"%2B"还原为加号
183- return decoded .replace ("%2B" , "+" );
184-
185- }
186-
187168 public static String queryParametersString (Map <String , String > keyValues ) {
188169
189170 if (keyValues == null ) {
You can’t perform that action at this time.
0 commit comments