diff options
author | Philippe Marti <philmarti@google.com> | 2010-12-17 14:49:19 +0000 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2011-01-13 14:16:20 +0000 |
commit | 84cc2dbb1d9f935182fcbeb1ef68dc340d2ebade (patch) | |
tree | 547620b424e1d8ae2de0fe4eefa44599a379be38 /tests/DumpRenderTree2 | |
parent | 96100195f06d9be287f2577a41f498917b34f7ef (diff) | |
download | frameworks_base-84cc2dbb1d9f935182fcbeb1ef68dc340d2ebade.zip frameworks_base-84cc2dbb1d9f935182fcbeb1ef68dc340d2ebade.tar.gz frameworks_base-84cc2dbb1d9f935182fcbeb1ef68dc340d2ebade.tar.bz2 |
Improve error handling (NPE in DRT2)
Bug: 3284126
Change-Id: I7f8c6259f2932d2b1a10a2f9612866786d425da9
Diffstat (limited to 'tests/DumpRenderTree2')
-rwxr-xr-x | tests/DumpRenderTree2/assets/run_layout_tests.py | 1 | ||||
-rw-r--r-- | tests/DumpRenderTree2/src/com/android/dumprendertree2/FileFilter.java | 20 |
2 files changed, 13 insertions, 8 deletions
diff --git a/tests/DumpRenderTree2/assets/run_layout_tests.py b/tests/DumpRenderTree2/assets/run_layout_tests.py index 0dfd229..3b8c09a 100755 --- a/tests/DumpRenderTree2/assets/run_layout_tests.py +++ b/tests/DumpRenderTree2/assets/run_layout_tests.py @@ -42,6 +42,7 @@ def main(path, options): cmd += "-w com.android.dumprendertree2/com.android.dumprendertree2.scriptsupport.ScriptTestRunner" logging.info("Running the tests...") + logging.debug("Command = %s" % cmd) (stdoutdata, stderrdata) = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate() if re.search("^INSTRUMENTATION_STATUS_CODE: -1", stdoutdata, re.MULTILINE) != None: logging.info("Failed to run the tests. Is DumpRenderTree2 installed on the device?") diff --git a/tests/DumpRenderTree2/src/com/android/dumprendertree2/FileFilter.java b/tests/DumpRenderTree2/src/com/android/dumprendertree2/FileFilter.java index 6c33a21..5360e3d 100644 --- a/tests/DumpRenderTree2/src/com/android/dumprendertree2/FileFilter.java +++ b/tests/DumpRenderTree2/src/com/android/dumprendertree2/FileFilter.java @@ -68,8 +68,8 @@ public class FileFilter { public void loadTestExpectations() { URL url = null; try { - url = new URL(ForwarderManager.getHostSchemePort(false) + "LayoutTests/" + - TEST_EXPECTATIONS_TXT_PATH); + url = new URL(ForwarderManager.getHostSchemePort(false) + + "LayoutTests/" + TEST_EXPECTATIONS_TXT_PATH); } catch (MalformedURLException e) { assert false; } @@ -78,9 +78,14 @@ public class FileFilter { InputStream inputStream = null; BufferedReader bufferedReader = null; try { - bufferedReader = new BufferedReader(new StringReader(new String( - FsUtils.readDataFromUrl(url)))); - + byte[] httpAnswer = FsUtils.readDataFromUrl(url); + if (httpAnswer == null) { + Log.w(LOG_TAG, "loadTestExpectations(): File not found: " + + TEST_EXPECTATIONS_TXT_PATH); + return; + } + bufferedReader = new BufferedReader(new StringReader( + new String(httpAnswer))); String line; String entry; String[] parts; @@ -113,7 +118,8 @@ public class FileFilter { path = trimTrailingSlashIfPresent(parts[0]); /** Split on whitespace */ - tokens = new HashSet<String>(Arrays.asList(parts[1].split("\\s", 0))); + tokens = new HashSet<String>(Arrays.asList( + parts[1].split("\\s", 0))); /** Chose the right collections to add to */ if (tokens.contains(TOKEN_CRASH)) { @@ -138,8 +144,6 @@ public class FileFilter { bufferedReader.close(); } } - } catch (FileNotFoundException e) { - Log.w(LOG_TAG, "reloadConfiguration(): File not found: " + e.getMessage()); } catch (IOException e) { Log.e(LOG_TAG, "url=" + url, e); } |