summaryrefslogtreecommitdiff
path: root/annotations/generate_annotated_java_files.py
diff options
context:
space:
mode:
authorTobias Thierer <tobiast@google.com>2018-11-19 15:19:15 +0000
committerTobias Thierer <tobiast@google.com>2019-07-09 09:11:07 +0000
commitf004524a19b2b5fa5dfbb87c417fde00b09f81b1 (patch)
treed6ddd09f75e76afe36dcac8757388a99328f4661 /annotations/generate_annotated_java_files.py
parent56efb716cc25e511587794fd77d886b0e6c54763 (diff)
Fix harmony URLConnectionTest hanging for 25sec.
The Handler for file:// URLs contains a fallback to FtpURLConnection for URLs with nonempty host (with some exceptions). URLConnectionTest.test_getContentType() contained a typo ("file:/" instead of "file://"). This led to the URL having a non-empty host value ("data"), which triggered a fallback to FtpURLConnection in the Handler for file:// URLs. The test attempted to resolve the host "data", eventually timing out. getContentType() by itself swallows any IOException and just returns null, and the test was written to tolerate null, so it didn't fail. The test code hasn't been touched since the initial commit in 2009, which makes it hard to tell whether the null tolerance was because someone had observed the test failing (but not understood why), or perhaps wanted to make the test tolerant of poor contentType detection. This CL fixes the typo, which makes the test pass in milliseconds rather than in 25+ seconds. This CL also makes the test stricter by checking specifically for "text/html" rather than a case-insensitive version of it or null. It also checks for a file:// (as opposed to ftp://) URLConnection for the two cases fixed by this CL and by http://r.android.com/82755 (commit 2587ef91ba693d73e97704e8163c050b286e7330). The logic for fallback to FtpURLConnection remains in place; basic test coverage for it exists in org.apache.harmony.tests.java.net.URLTest#test_openConnection_FileProtocol (this CL fixes a minor typo in that test name). The test appears to derive from code written for https://issues.apache.org/jira/browse/HARMONY-5779 Test: atest CtsLibcoreTestCases:org.apache.harmony.luni.tests.java.net.URLConnectionTest Test: atest CtsLibcoreTestCases:org.apache.harmony.tests.java.net.URLTest Test: CtsLibcoreTestCases Test: Checked that nothing else in CtsLibcoreTestCases relies on the fallback to FtpURLConnection by locally replacing it with an AssertionError and checking that the only failing test is test_openConnection_FileProtocol(). Fixes: 119607552 Change-Id: Ib5bf45f11e49c56a34fda5fe3cb27485c2d7176c (cherry picked from commit 7b3ef9bcb59bcf836ac5e0bf7605ad3ff46c8503)
Diffstat (limited to 'annotations/generate_annotated_java_files.py')
0 files changed, 0 insertions, 0 deletions