Download failure wasn't reported on some devices

This commit is contained in:
daniel oeh 2012-09-24 14:37:08 +02:00
parent 08e4408717
commit ca9a425239
1 changed files with 8 additions and 10 deletions

View File

@ -13,6 +13,8 @@ import java.net.SocketTimeoutException;
import java.net.URL;
import java.net.UnknownHostException;
import org.apache.commons.io.IOUtils;
import android.util.Log;
import de.danoeh.antennapod.AppConfig;
import de.danoeh.antennapod.R;
@ -100,17 +102,13 @@ public class HttpDownloader extends Downloader {
} catch (IOException e) {
e.printStackTrace();
onFail(DownloadError.ERROR_IO_ERROR, e.getMessage());
}catch (NullPointerException e) {
// might be thrown by connection.getInputStream()
e.printStackTrace();
onFail(DownloadError.ERROR_CONNECTION_ERROR, status.getFeedFile().getDownload_url());
} finally {
if (connection != null) {
connection.disconnect();
}
if (out != null) {
try {
out.close();
} catch (IOException e) {
e.printStackTrace();
}
}
IOUtils.close(connection);
IOUtils.closeQuietly(out);
}
}