aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorKurt Partridge <kep@google.com>2013-05-15 10:36:24 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2013-05-15 10:36:24 -0700
commit4a885f254ded4964a8140a577ac1ca2991117a40 (patch)
treefcf8e8721080db8adb5d2ff0d2d6436b6b07f520 /java/src
parent80a6848d8a570b1c6cac6246c1fa283dcd072d40 (diff)
parentb20c7ee75093ae9c111daf64d9e4f8509d692824 (diff)
downloadlatinime-4a885f254ded4964a8140a577ac1ca2991117a40.tar.gz
latinime-4a885f254ded4964a8140a577ac1ca2991117a40.tar.xz
latinime-4a885f254ded4964a8140a577ac1ca2991117a40.zip
am b20c7ee7: am 1f99e04b: Merge "Fix JsonWriter bug"
* commit 'b20c7ee75093ae9c111daf64d9e4f8509d692824': Fix JsonWriter bug
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/research/ResearchLog.java16
1 files changed, 13 insertions, 3 deletions
diff --git a/java/src/com/android/inputmethod/research/ResearchLog.java b/java/src/com/android/inputmethod/research/ResearchLog.java
index 35a491f2c..18bf7ba54 100644
--- a/java/src/com/android/inputmethod/research/ResearchLog.java
+++ b/java/src/com/android/inputmethod/research/ResearchLog.java
@@ -108,10 +108,14 @@ public class ResearchLog {
@Override
public Object call() throws Exception {
try {
- if (mHasWrittenData) {
- mJsonWriter.endArray();
- mHasWrittenData = false;
+ // TODO: This is necessary to avoid an exception. Better would be to not even
+ // open the JsonWriter if the file is not even opened unless there is valid data
+ // to write.
+ if (!mHasWrittenData) {
+ mJsonWriter.beginArray();
}
+ mJsonWriter.endArray();
+ mHasWrittenData = false;
mJsonWriter.flush();
mJsonWriter.close();
if (DEBUG) {
@@ -159,6 +163,12 @@ public class ResearchLog {
public Object call() throws Exception {
try {
if (mHasWrittenData) {
+ // TODO: This is necessary to avoid an exception. Better would be to not
+ // even open the JsonWriter if the file is not even opened unless there is
+ // valid data to write.
+ if (!mHasWrittenData) {
+ mJsonWriter.beginArray();
+ }
mJsonWriter.endArray();
mJsonWriter.close();
mHasWrittenData = false;