diff options
author | Guang Zhu <guangzhu@google.com> | 2010-08-18 13:36:11 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2010-08-18 13:36:11 -0700 |
commit | f3c6c24d6ba7dd448c67fc064a7becc029c5981f (patch) | |
tree | 76abfc89b52334360c47c9fa1c382196070e6a15 /tests | |
parent | 6b53dd49e419f926d9daf36399962b8a0c33c580 (diff) | |
parent | 179b9a1fe98d371dc2064322ec227ba13065f921 (diff) | |
download | packages_apps_Browser-f3c6c24d6ba7dd448c67fc064a7becc029c5981f.zip packages_apps_Browser-f3c6c24d6ba7dd448c67fc064a7becc029c5981f.tar.gz packages_apps_Browser-f3c6c24d6ba7dd448c67fc064a7becc029c5981f.tar.bz2 |
am 179b9a1f: improvement test app\'s handling of irregular status file
Merge commit '179b9a1fe98d371dc2064322ec227ba13065f921' into gingerbread-plus-aosp
* commit '179b9a1fe98d371dc2064322ec227ba13065f921':
improvement test app's handling of irregular status file
Diffstat (limited to 'tests')
-rw-r--r-- | tests/src/com/android/browser/PopularUrlsTest.java | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/tests/src/com/android/browser/PopularUrlsTest.java b/tests/src/com/android/browser/PopularUrlsTest.java index 547cb9f..98a0e9f 100644 --- a/tests/src/com/android/browser/PopularUrlsTest.java +++ b/tests/src/com/android/browser/PopularUrlsTest.java @@ -274,16 +274,26 @@ public class PopularUrlsTest extends ActivityInstrumentationTestCase2<BrowserAct mFile = new File(file); FileReader input = null; BufferedReader reader = null; + isRecovery = false; + iteration = 0; + page = 0; try { input = new FileReader(mFile); isRecovery = true; reader = new BufferedReader(input); - iteration = Integer.parseInt(reader.readLine()); - page = Integer.parseInt(reader.readLine()); + String line = reader.readLine(); + if (line == null) + return; + iteration = Integer.parseInt(line); + line = reader.readLine(); + if (line == null) + return; + page = Integer.parseInt(line); } catch (FileNotFoundException ex) { - isRecovery = false; - iteration = 0; - page = 0; + return; + } catch (NumberFormatException nfe) { + Log.wtf(TAG, "unexpected data in status file, will start from begining"); + return; } finally { try { if (reader != null) { |