Skip to content
Snippets Groups Projects
Commit 352c9162 authored by Kartikaya Gupta's avatar Kartikaya Gupta
Browse files

Bug 710864 - Close stream after we're done with it. r=blassey

parent 919fdf2c
No related branches found
No related tags found
No related merge requests found
......@@ -42,6 +42,7 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.io.IOException;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
......@@ -253,9 +254,19 @@ public class AboutHomeContent extends ScrollView {
if (fileStream == null)
return;
StringBuffer jsonString = new StringBuffer();
int read = 0;
while ((read = fileStream.read(buf, 0, 32768)) != -1) {
jsonString.append(new String(buf, 0, read));
try {
int read = 0;
while ((read = fileStream.read(buf, 0, 32768)) != -1) {
jsonString.append(new String(buf, 0, read));
}
} finally {
try {
fileStream.close();
} catch (IOException ioe) {
// catch this here because we can continue even if the
// close failed
Log.i(LOGTAG, "error closing json file", ioe);
}
}
final JSONArray array = new JSONObject(jsonString.toString()).getJSONArray("addons");
GeckoApp.mAppContext.mMainHandler.post(new Runnable() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment