From 7d72ca0b20334aba077e3a01d7b12f6f34618076 Mon Sep 17 00:00:00 2001 From: Kurt Partridge Date: Thu, 9 May 2013 14:25:28 -0700 Subject: Avoid JsonWriter multi-write error JsonWriter requires that its clients pass it only a single top-level object. The existing implementation tries to make code cleaner by having mJsonWriter never be null, and instead use a global static "NULL_JSON_WRITER" that just discards data. But because JsonWriter complains if more than one top-level object is passed, making this a global object does not work. This change instead copes with mJsonWriter being null. Change-Id: Ia37ccfc8646e91f11a64713dd92d2846eb86ac54 --- java/src/com/android/inputmethod/research/LogUnit.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'java/src/com/android/inputmethod/research/LogUnit.java') diff --git a/java/src/com/android/inputmethod/research/LogUnit.java b/java/src/com/android/inputmethod/research/LogUnit.java index 4d60bda53..cf1388f46 100644 --- a/java/src/com/android/inputmethod/research/LogUnit.java +++ b/java/src/com/android/inputmethod/research/LogUnit.java @@ -25,6 +25,7 @@ import com.android.inputmethod.latin.SuggestedWords; import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo; import com.android.inputmethod.latin.define.ProductionFlag; +import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -135,9 +136,11 @@ public class LogUnit { * @param researchLog where to publish the contents of this {@code LogUnit} * @param canIncludePrivateData whether the private data in this {@code LogUnit} should be * included + * + * @throws IOException if publication to the log file is not possible */ public synchronized void publishTo(final ResearchLog researchLog, - final boolean canIncludePrivateData) { + final boolean canIncludePrivateData) throws IOException { // Write out any logStatement that passes the privacy filter. final int size = mLogStatementList.size(); if (size != 0) { -- cgit v1.2.3-83-g751a