Fix missing close of Closeables caught by StrictMode

This commit is contained in:
Cameron Gutman 2015-03-29 23:25:00 -04:00
parent b5ba59b413
commit d822980d5a
3 changed files with 10 additions and 0 deletions

Binary file not shown.

View File

@ -10,6 +10,7 @@ import android.widget.ImageView;
import com.limelight.nvstream.http.ComputerDetails; import com.limelight.nvstream.http.ComputerDetails;
import com.limelight.nvstream.http.NvApp; import com.limelight.nvstream.http.NvApp;
import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.LinkedBlockingQueue;
@ -97,6 +98,11 @@ public class CachedAppAssetLoader {
// Write the stream straight to disk // Write the stream straight to disk
diskLoader.populateCacheWithStream(tuple, in); diskLoader.populateCacheWithStream(tuple, in);
// Close the network input stream
try {
in.close();
} catch (IOException ignored) {}
// If there's a task associated with this load, we should return the bitmap // If there's a task associated with this load, we should return the bitmap
if (task != null) { if (task != null) {
return diskLoader.loadBitmapFromCache(tuple, (int) scalingDivider); return diskLoader.loadBitmapFromCache(tuple, (int) scalingDivider);

View File

@ -61,6 +61,10 @@ public class CacheHelper {
sb.append(buf, 0, bytesRead); sb.append(buf, 0, bytesRead);
} }
try {
in.close();
} catch (IOException ignored) {}
return sb.toString(); return sb.toString();
} }