aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/research/ResearchLog.java
diff options
context:
space:
mode:
authorKurt Partridge <kep@google.com>2013-02-05 12:14:03 -0800
committerKurt Partridge <kep@google.com>2013-02-12 20:48:44 -0800
commit531dd150eb1ddf88cb09c404a14834893c82f960 (patch)
treec4dce1395609c9d98415cbaf6bec29246115cc0a /java/src/com/android/inputmethod/research/ResearchLog.java
parent69cc3cfe1f2fd1ce3bea7752745f4f0c7a35aa3a (diff)
downloadlatinime-531dd150eb1ddf88cb09c404a14834893c82f960.tar.gz
latinime-531dd150eb1ddf88cb09c404a14834893c82f960.tar.xz
latinime-531dd150eb1ddf88cb09c404a14834893c82f960.zip
Cleanup in preparation for tests
multi-project commit with I1212da392ecda0ad78962da68941870b5a651eee Change-Id: Ie74af59d4e45bf954723fee9dcf350a36468c381
Diffstat (limited to 'java/src/com/android/inputmethod/research/ResearchLog.java')
-rw-r--r--java/src/com/android/inputmethod/research/ResearchLog.java13
1 files changed, 6 insertions, 7 deletions
diff --git a/java/src/com/android/inputmethod/research/ResearchLog.java b/java/src/com/android/inputmethod/research/ResearchLog.java
index 24bf7d15f..5114977d8 100644
--- a/java/src/com/android/inputmethod/research/ResearchLog.java
+++ b/java/src/com/android/inputmethod/research/ResearchLog.java
@@ -81,10 +81,7 @@ public class ResearchLog {
}
}
- public ResearchLog(final File outputFile, Context context) {
- if (outputFile == null) {
- throw new IllegalArgumentException();
- }
+ public ResearchLog(final File outputFile, final Context context) {
mExecutor = Executors.newSingleThreadScheduledExecutor();
mFile = outputFile;
mContext = context;
@@ -112,7 +109,7 @@ public class ResearchLog {
Log.d(TAG, "error when closing ResearchLog:");
e.printStackTrace();
} finally {
- if (mFile.exists()) {
+ if (mFile != null && mFile.exists()) {
mFile.setWritable(false, false);
}
if (onClosed != null) {
@@ -139,7 +136,9 @@ public class ResearchLog {
mHasWrittenData = false;
}
} finally {
- mIsAbortSuccessful = mFile.delete();
+ if (mFile != null) {
+ mIsAbortSuccessful = mFile.delete();
+ }
}
return null;
}
@@ -209,7 +208,7 @@ public class ResearchLog {
*/
public JsonWriter getValidJsonWriterLocked() {
try {
- if (mJsonWriter == NULL_JSON_WRITER) {
+ if (mJsonWriter == NULL_JSON_WRITER && mFile != null) {
final FileOutputStream fos =
mContext.openFileOutput(mFile.getName(), Context.MODE_PRIVATE);
mJsonWriter = new JsonWriter(new BufferedWriter(new OutputStreamWriter(fos)));