зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 6d26ad68f31f (bug 1356693
)
--HG-- extra : rebase_source : 2f0adc16fa93b32d8183fa51b36cbb02e95597bd
This commit is contained in:
Родитель
30461c9143
Коммит
d7e4098cb8
|
@ -31,7 +31,6 @@ import org.mozilla.apache.commons.codec.binary.Base64;
|
|||
import org.mozilla.gecko.background.common.log.Logger;
|
||||
import org.mozilla.gecko.background.nativecode.NativeCrypto;
|
||||
import org.mozilla.gecko.sync.setup.Constants;
|
||||
import org.mozilla.gecko.util.IOUtils;
|
||||
import org.mozilla.gecko.util.StringUtils;
|
||||
|
||||
import android.content.Context;
|
||||
|
@ -489,10 +488,14 @@ public class Utils {
|
|||
throw new IllegalArgumentException("Passed null filename in readFile.");
|
||||
}
|
||||
|
||||
FileInputStream fis = null;
|
||||
InputStreamReader isr = null;
|
||||
BufferedReader br = null;
|
||||
|
||||
try {
|
||||
br = new BufferedReader(new InputStreamReader(context.openFileInput(filename), StringUtils.UTF_8));
|
||||
fis = context.openFileInput(filename);
|
||||
isr = new InputStreamReader(fis, StringUtils.UTF_8);
|
||||
br = new BufferedReader(isr);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
String line;
|
||||
while ((line = br.readLine()) != null) {
|
||||
|
@ -502,7 +505,20 @@ public class Utils {
|
|||
} catch (Exception e) {
|
||||
return null;
|
||||
} finally {
|
||||
IOUtils.safeStreamClose(br);
|
||||
if (isr != null) {
|
||||
try {
|
||||
isr.close();
|
||||
} catch (IOException e) {
|
||||
// Ignore.
|
||||
}
|
||||
}
|
||||
if (fis != null) {
|
||||
try {
|
||||
fis.close();
|
||||
} catch (IOException e) {
|
||||
// Ignore.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@ import org.mozilla.gecko.background.common.log.Logger;
|
|||
import org.mozilla.gecko.sync.ExtendedJSONObject;
|
||||
import org.mozilla.gecko.sync.NonArrayJSONException;
|
||||
import org.mozilla.gecko.sync.NonObjectJSONException;
|
||||
import org.mozilla.gecko.util.IOUtils;
|
||||
import org.mozilla.gecko.util.StringUtils;
|
||||
|
||||
import ch.boye.httpclientandroidlib.Header;
|
||||
|
@ -107,12 +106,12 @@ public class MozResponse {
|
|||
throw new IOException("no entity");
|
||||
}
|
||||
|
||||
Reader in = null;
|
||||
InputStream content = entity.getContent();
|
||||
try {
|
||||
in = new BufferedReader(new InputStreamReader(entity.getContent(), StringUtils.UTF_8));
|
||||
Reader in = new BufferedReader(new InputStreamReader(content, "UTF-8"));
|
||||
return new ExtendedJSONObject(in);
|
||||
} finally {
|
||||
IOUtils.safeStreamClose(in);
|
||||
content.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче