diff options
author | 2013-02-15 12:47:48 -0800 | |
---|---|---|
committer | 2013-02-21 17:01:08 -0800 | |
commit | 744b363ae8bf7cf66809d4afae12d5cc860adef4 (patch) | |
tree | 2b2a1a0cc617626f54f8050418976f8b3a5d5af5 /java/src/com/android/inputmethod/research/ResearchLog.java | |
parent | 78c1ad32e67fcb11448e23661aec33675f3dfa3b (diff) | |
download | latinime-744b363ae8bf7cf66809d4afae12d5cc860adef4.tar.gz latinime-744b363ae8bf7cf66809d4afae12d5cc860adef4.tar.xz latinime-744b363ae8bf7cf66809d4afae12d5cc860adef4.zip |
[TestPrep8] Narrow try/catch scope
Change-Id: If15f250feb81c2ad55ce1bc7dc3dafa57de87aef
Diffstat (limited to 'java/src/com/android/inputmethod/research/ResearchLog.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; |