Do not retry autodownload after SSL errors (#4821)
This commit is contained in:
parent
2588b0eca7
commit
7659fd25d8
|
@ -25,7 +25,6 @@ import org.greenrobot.eventbus.EventBus;
|
|||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
@ -325,18 +324,11 @@ public class DownloadService extends Service {
|
|||
if (item == null) {
|
||||
return;
|
||||
}
|
||||
boolean httpNotFound = status.getReason() == DownloadError.ERROR_HTTP_DATA_ERROR
|
||||
&& String.valueOf(HttpURLConnection.HTTP_NOT_FOUND).equals(status.getReasonDetailed());
|
||||
boolean forbidden = status.getReason() == DownloadError.ERROR_FORBIDDEN
|
||||
&& String.valueOf(HttpURLConnection.HTTP_FORBIDDEN).equals(status.getReasonDetailed());
|
||||
boolean notEnoughSpace = status.getReason() == DownloadError.ERROR_NOT_ENOUGH_SPACE;
|
||||
boolean wrongFileType = status.getReason() == DownloadError.ERROR_FILE_TYPE;
|
||||
boolean httpGone = status.getReason() == DownloadError.ERROR_HTTP_DATA_ERROR
|
||||
&& String.valueOf(HttpURLConnection.HTTP_GONE).equals(status.getReasonDetailed());
|
||||
boolean httpBadReq = status.getReason() == DownloadError.ERROR_HTTP_DATA_ERROR
|
||||
&& String.valueOf(HttpURLConnection.HTTP_BAD_REQUEST).equals(status.getReasonDetailed());
|
||||
boolean unknownHost = status.getReason() == DownloadError.ERROR_UNKNOWN_HOST;
|
||||
boolean unsupportedType = status.getReason() == DownloadError.ERROR_UNSUPPORTED_TYPE;
|
||||
boolean wrongSize = status.getReason() == DownloadError.ERROR_IO_WRONG_SIZE;
|
||||
|
||||
if (httpNotFound || forbidden || notEnoughSpace || wrongFileType || httpGone || httpBadReq ) {
|
||||
if (! (unknownHost || unsupportedType || wrongSize)) {
|
||||
try {
|
||||
DBWriter.saveFeedItemAutoDownloadFailed(item).get();
|
||||
} catch (ExecutionException | InterruptedException e) {
|
||||
|
|
|
@ -223,7 +223,7 @@ public class HttpDownloader extends Downloader {
|
|||
// written file. This check cannot be made if compression was used
|
||||
if (!isGzip && request.getSize() != DownloadStatus.SIZE_UNKNOWN &&
|
||||
request.getSoFar() != request.getSize()) {
|
||||
onFail(DownloadError.ERROR_IO_ERROR, "Download completed but size: " +
|
||||
onFail(DownloadError.ERROR_IO_WRONG_SIZE, "Download completed but size: " +
|
||||
request.getSoFar() + " does not equal expected size " + request.getSize());
|
||||
return;
|
||||
} else if (request.getSize() > 0 && request.getSoFar() == 0) {
|
||||
|
|
|
@ -19,11 +19,11 @@ public enum DownloadError {
|
|||
ERROR_NOT_ENOUGH_SPACE(10, R.string.download_error_insufficient_space),
|
||||
ERROR_UNKNOWN_HOST(11, R.string.download_error_unknown_host),
|
||||
ERROR_REQUEST_ERROR(12, R.string.download_error_request_error),
|
||||
ERROR_DB_ACCESS_ERROR(13, R.string.download_error_db_access),
|
||||
ERROR_UNAUTHORIZED(14, R.string.download_error_unauthorized),
|
||||
ERROR_DB_ACCESS_ERROR(13, R.string.download_error_db_access),
|
||||
ERROR_UNAUTHORIZED(14, R.string.download_error_unauthorized),
|
||||
ERROR_FILE_TYPE(15, R.string.download_error_file_type_type),
|
||||
ERROR_FORBIDDEN(16, R.string.download_error_forbidden);
|
||||
|
||||
ERROR_FORBIDDEN(16, R.string.download_error_forbidden),
|
||||
ERROR_IO_WRONG_SIZE(17, R.string.download_error_forbidden);
|
||||
|
||||
private final int code;
|
||||
private final int resId;
|
||||
|
|
|
@ -243,6 +243,7 @@
|
|||
<string name="download_error_file_type_type">File Type Error</string>
|
||||
<string name="download_error_forbidden">Forbidden</string>
|
||||
<string name="download_canceled_msg">Download canceled</string>
|
||||
<string name="download_wrong_size">The server connection was lost before completing the download</string>
|
||||
<string name="download_canceled_autodownload_enabled_msg">Download canceled\nDisabled <i>Auto Download</i> for this item</string>
|
||||
<string name="download_report_title">Downloads completed with error(s)</string>
|
||||
<string name="auto_download_report_title">Auto-downloads completed</string>
|
||||
|
|
Loading…
Reference in New Issue