Skip to content

Commit

Permalink
Fix unclosed OutputStream in DiskLruCacheWrapper (reported by StrictM…
Browse files Browse the repository at this point in the history
…ode).
  • Loading branch information
vickychijwani committed Feb 15, 2014
1 parent d5ddd93 commit 0ff76fe
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

/**
* The default DiskCache implementation. There must be no more than one active instance for a given
Expand Down Expand Up @@ -77,8 +78,10 @@ public void put(String key, Writer writer) {
//editor will be null if there are two concurrent puts
//worst case just silently fail
if (editor != null) {
writer.write(editor.newOutputStream(0));
OutputStream os = editor.newOutputStream(0);
writer.write(os);
editor.commit();
os.close();
}
} catch (IOException e) {
e.printStackTrace();
Expand Down

0 comments on commit 0ff76fe

Please sign in to comment.