diff options
author | 2013-02-22 11:39:44 -0800 | |
---|---|---|
committer | 2013-02-22 11:39:44 -0800 | |
commit | b9825bf30e7dc9ec1b82ed2f5eccdd58c6ddf46d (patch) | |
tree | a439805d8369603cf677f154b7e6be26f633b24a /java | |
parent | 3e279243c1d8c959278c51234b8bc2221a609c56 (diff) | |
parent | b5c2033aa526b91b9ef3b71691a3ae11f657e135 (diff) | |
download | latinime-b9825bf30e7dc9ec1b82ed2f5eccdd58c6ddf46d.tar.gz latinime-b9825bf30e7dc9ec1b82ed2f5eccdd58c6ddf46d.tar.xz latinime-b9825bf30e7dc9ec1b82ed2f5eccdd58c6ddf46d.zip |
am b5c2033a: Merge "[TestPrep8] Narrow try/catch scope"
* commit 'b5c2033aa526b91b9ef3b71691a3ae11f657e135':
[TestPrep8] Narrow try/catch scope
Diffstat (limited to 'java')
-rw-r--r-- | java/src/com/android/inputmethod/research/ResearchLog.java | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/java/src/com/android/inputmethod/research/ResearchLog.java b/java/src/com/android/inputmethod/research/ResearchLog.java index 2303ebcfe..99d84938f 100644 --- a/java/src/com/android/inputmethod/research/ResearchLog.java +++ b/java/src/com/android/inputmethod/research/ResearchLog.java @@ -207,23 +207,22 @@ public class ResearchLog { * called. The cached value is returned in future calls. */ public JsonWriter getInitializedJsonWriterLocked() { + if (mJsonWriter != NULL_JSON_WRITER || mFile == null) return mJsonWriter; try { - if (mJsonWriter == NULL_JSON_WRITER && mFile != null) { - final JsonWriter jsonWriter = createJsonWriter(mContext, mFile); - if (jsonWriter != null) { - jsonWriter.beginArray(); - mJsonWriter = jsonWriter; - mHasWrittenData = true; - } + final JsonWriter jsonWriter = createJsonWriter(mContext, mFile); + if (jsonWriter != null) { + jsonWriter.beginArray(); + mJsonWriter = jsonWriter; + mHasWrittenData = true; } - } catch (IOException e) { + } catch (final IOException e) { Log.w(TAG, "Error in JsonWriter; disabling logging", e); try { mJsonWriter.close(); - } catch (IllegalStateException e1) { + } catch (final IllegalStateException e1) { // Assume that this is just the json not being terminated properly. // Ignore - } catch (IOException e1) { + } catch (final IOException e1) { Log.w(TAG, "Error in closing JsonWriter; disabling logging", e1); } finally { mJsonWriter = NULL_JSON_WRITER; |