aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2014-03-21 23:20:17 -0700
committerScott Jackson <daneren2005@gmail.com>2014-03-21 23:20:17 -0700
commit1aabeb57a59c7d0e8f88a939f3f1e987a296cd93 (patch)
treef7a60400c29807d123bf3a898b41b009bd0e5429 /src
parente1cf6f3b193e29ee8ffdc8a10ccb15f42c566bc6 (diff)
downloaddsub-1aabeb57a59c7d0e8f88a939f3f1e987a296cd93.tar.gz
dsub-1aabeb57a59c7d0e8f88a939f3f1e987a296cd93.tar.bz2
dsub-1aabeb57a59c7d0e8f88a939f3f1e987a296cd93.zip
Better handling of 0 length songs
Diffstat (limited to 'src')
-rw-r--r--src/github/daneren2005/dsub/service/DownloadFile.java4
-rw-r--r--src/github/daneren2005/dsub/service/DownloadService.java2
2 files changed, 4 insertions, 2 deletions
diff --git a/src/github/daneren2005/dsub/service/DownloadFile.java b/src/github/daneren2005/dsub/service/DownloadFile.java
index 965a2a6f..fb0e50d0 100644
--- a/src/github/daneren2005/dsub/service/DownloadFile.java
+++ b/src/github/daneren2005/dsub/service/DownloadFile.java
@@ -398,6 +398,8 @@ public class DownloadFile implements BufferFile {
if (isCancelled()) {
throw new Exception("Download of '" + song + "' was cancelled");
+ } else if(partialFile.length() == 0) {
+ throw new Exception("Download of '" + song + "' failed. File is 0 bytes long.");
}
downloadAndSaveCoverArt(musicService);
@@ -449,7 +451,7 @@ public class DownloadFile implements BufferFile {
}
new CacheCleaner(context, DownloadService.getInstance()).cleanSpace();
if(DownloadService.getInstance() != null) {
- ((DownloadService) DownloadService.getInstance()).checkDownloads();
+ DownloadService.getInstance().checkDownloads();
}
}
diff --git a/src/github/daneren2005/dsub/service/DownloadService.java b/src/github/daneren2005/dsub/service/DownloadService.java
index 2d82e5fb..cb2fdcb2 100644
--- a/src/github/daneren2005/dsub/service/DownloadService.java
+++ b/src/github/daneren2005/dsub/service/DownloadService.java
@@ -1704,7 +1704,7 @@ public class DownloadService extends Service {
while (!bufferComplete()) {
Thread.sleep(1000L);
- if (isCancelled()) {
+ if (isCancelled() || downloadFile.isFailedMax()) {
return null;
}
}