1515
1616import java .io .File ;
1717import java .io .IOException ;
18- import java .net .URI ;
1918
2019/**
2120 * 表单上传
@@ -124,10 +123,7 @@ public void complete(ResponseInfo info, JSONObject response) {
124123 if (info .isOK ()) {
125124 options .progressHandler .progress (key , 1.0 );
126125 completionHandler .complete (key , info , response );
127- } else if (options .cancellationSignal .isCancelled ()) {
128- ResponseInfo i = ResponseInfo .cancelled (token );
129- completionHandler .complete (key , i , null );
130- } else if (info .needRetry () || (info .isNotQiniu () && !token .hasReturnUrl ())) {
126+ } else if (info .needRetry ()) {
131127 final String upHostRetry = config .zone .upHost (token .token , config .useHttps , upHost );
132128 Log .d ("Qiniu.FormUploader" , "retry upload first time use up host " + upHostRetry );
133129 CompletionHandler retried = new CompletionHandler () {
@@ -136,15 +132,15 @@ public void complete(ResponseInfo info, JSONObject response) {
136132 if (info .isOK ()) {
137133 options .progressHandler .progress (key , 1.0 );
138134 completionHandler .complete (key , info , response );
139- } else if (info .needRetry () || ( info . isNotQiniu () && ! token . hasReturnUrl ()) ) {
135+ } else if (info .needRetry ()) {
140136 final String upHostRetry2 = config .zone .upHost (token .token , config .useHttps , upHostRetry );
141137 Log .d ("Qiniu.FormUploader" , "retry upload second time use up host " + upHostRetry2 );
142138 CompletionHandler retried2 = new CompletionHandler () {
143139 @ Override
144140 public void complete (ResponseInfo info2 , JSONObject response2 ) {
145141 if (info2 .isOK ()) {
146142 options .progressHandler .progress (key , 1.0 );
147- } else if (info2 .needRetry () || ( info2 . isNotQiniu () && ! token . hasReturnUrl ()) ) {
143+ } else if (info2 .needRetry ()) {
148144 config .zone .frozenDomain (upHostRetry2 );
149145 }
150146 completionHandler .complete (key , info2 , response2 );
@@ -256,7 +252,7 @@ private static ResponseInfo syncUpload0(Client client, Configuration config, byt
256252 }
257253
258254 //retry for the first time
259- if (info .needRetry () || ( info . isNotQiniu () && ! token . hasReturnUrl ()) ) {
255+ if (info .needRetry ()) {
260256 if (info .isNetworkBroken () && !AndroidNetwork .isNetWorkReady ()) {
261257 options .netReadyHandler .waitReady ();
262258 if (!AndroidNetwork .isNetWorkReady ()) {
@@ -269,7 +265,7 @@ private static ResponseInfo syncUpload0(Client client, Configuration config, byt
269265 Log .d ("Qiniu.FormUploader" , "sync upload retry first time use up host " + upHostRetry );
270266 info = client .syncMultipartPost (upHostRetry , args , token );
271267
272- if (info .needRetry () || ( info . isNotQiniu () && ! token . hasReturnUrl ()) ) {
268+ if (info .needRetry ()) {
273269 if (info .isNetworkBroken () && !AndroidNetwork .isNetWorkReady ()) {
274270 options .netReadyHandler .waitReady ();
275271 if (!AndroidNetwork .isNetWorkReady ()) {
@@ -280,7 +276,7 @@ private static ResponseInfo syncUpload0(Client client, Configuration config, byt
280276 String upHostRetry2 = config .zone .upHost (token .token , config .useHttps , upHostRetry );
281277 Log .d ("Qiniu.FormUploader" , "sync upload retry second time use up host " + upHostRetry2 );
282278 info = client .syncMultipartPost (upHostRetry2 , args , token );
283- if (info .needRetry () || ( info . isNotQiniu () && ! token . hasReturnUrl ()) ) {
279+ if (info .needRetry ()) {
284280 config .zone .frozenDomain (upHostRetry2 );
285281 }
286282 }
0 commit comments