diff options
author | Vasu Nori <vnori@google.com> | 2011-01-11 12:00:44 -0800 |
---|---|---|
committer | Vasu Nori <vnori@google.com> | 2011-01-11 12:57:26 -0800 |
commit | 597bbd96431ca1fb655a21285cfd5411a67bad16 (patch) | |
tree | f926a41e77948938b8ab20d89b7a8908e1df18dd /src/com/android/providers/downloads/DownloadThread.java | |
parent | ead1b057d86021f4f0a44bad8616ddae2aa39a40 (diff) | |
download | android_packages_providers_DownloadProvider-597bbd96431ca1fb655a21285cfd5411a67bad16.tar.gz android_packages_providers_DownloadProvider-597bbd96431ca1fb655a21285cfd5411a67bad16.tar.bz2 android_packages_providers_DownloadProvider-597bbd96431ca1fb655a21285cfd5411a67bad16.zip |
bug:3338089 NPE in downloadthread
Change-Id: I95b4c52598092e9f6ffa1713b36ac11d44e26279
Diffstat (limited to 'src/com/android/providers/downloads/DownloadThread.java')
-rw-r--r-- | src/com/android/providers/downloads/DownloadThread.java | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/com/android/providers/downloads/DownloadThread.java b/src/com/android/providers/downloads/DownloadThread.java index 8b8d8bd1..61fb209f 100644 --- a/src/com/android/providers/downloads/DownloadThread.java +++ b/src/com/android/providers/downloads/DownloadThread.java @@ -416,7 +416,8 @@ public class DownloadThread extends Thread { if (state.mStream == null) { state.mStream = new FileOutputStream(state.mFilename, true); } - mStorageManager.verifySpaceBeforeWritingToFile(mInfo.mDestination, null, bytesRead); + mStorageManager.verifySpaceBeforeWritingToFile(mInfo.mDestination, state.mFilename, + bytesRead); state.mStream.write(data, 0, bytesRead); if (mInfo.mDestination == Downloads.Impl.DESTINATION_EXTERNAL && !isDrmFile(state)) { @@ -424,7 +425,12 @@ public class DownloadThread extends Thread { } return; } catch (IOException ex) { - mStorageManager.verifySpace(mInfo.mDestination, null, bytesRead); + // couldn't write to file. are we out of space? check. + // TODO this check should only be done once. why is this being done + // in a while(true) loop (see the enclosing statement: for(;;) + if (state.mStream != null) { + mStorageManager.verifySpace(mInfo.mDestination, state.mFilename, bytesRead); + } } } } |