summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorGuang Zhu <guangzhu@google.com>2010-08-18 13:43:09 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2010-08-18 13:43:09 -0700
commit059fae07650065571bd902b4b794050d73c5a1ee (patch)
tree6de7ac304b0c78f091b542d85710ae2cad6ed7cc /tests
parent8ce956c6076a89aae85856f35b94bad7fc8fa1f1 (diff)
parentf3c6c24d6ba7dd448c67fc064a7becc029c5981f (diff)
downloadpackages_apps_Browser-059fae07650065571bd902b4b794050d73c5a1ee.tar.gz
packages_apps_Browser-059fae07650065571bd902b4b794050d73c5a1ee.tar.bz2
packages_apps_Browser-059fae07650065571bd902b4b794050d73c5a1ee.zip
am f3c6c24d: am 179b9a1f: improvement test app\'s handling of irregular status file
Merge commit 'f3c6c24d6ba7dd448c67fc064a7becc029c5981f' * commit 'f3c6c24d6ba7dd448c67fc064a7becc029c5981f': improvement test app's handling of irregular status file
Diffstat (limited to 'tests')
-rw-r--r--tests/src/com/android/browser/PopularUrlsTest.java20
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 547cb9f4b..98a0e9fc2 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) {