diff options
author | Yi Kong <yikong@google.com> | 2017-01-30 11:17:40 +0800 |
---|---|---|
committer | gitbuildkicker <android-build@google.com> | 2017-02-22 13:45:54 -0800 |
commit | 81a0842fdcd38c64ffa2ac917fc3094667b33770 (patch) | |
tree | 69132f5f3037899708c877ed8641e1fb0aa89195 | |
parent | b8f7e1af3d77903f00481216d9c63b4d3eb8b59b (diff) | |
download | libcore-nougat-mr1.3-release.tar.gz |
Fix URLTest#testAtSignInUserInfo failureandroid-7.1.1_r35nougat-mr1.3-release
This failure is introduced by libcore change 2e3689a.
The upstream security fix around URLStreamHandler changed behaviour for
URL parsing. Fix the test to match the new behaviour.
Bug: 34722749
Test: libcore.java.net.URLTest#testAtSignInUserInfo
Change-Id: I6a4a362f367e96f0dfe55afa117f201a39afa7cf
(cherry picked from commit eca3a9349803cb699d094772204d8c669fe6640b)
(cherry picked from commit 7e6977749c9b054f91fb216c9dc42d604119483c)
-rw-r--r-- | luni/src/test/java/libcore/java/net/URLTest.java | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/luni/src/test/java/libcore/java/net/URLTest.java b/luni/src/test/java/libcore/java/net/URLTest.java index 7a323af58e1..0eee1f8d9b0 100644 --- a/luni/src/test/java/libcore/java/net/URLTest.java +++ b/luni/src/test/java/libcore/java/net/URLTest.java @@ -194,12 +194,12 @@ public final class URLTest extends TestCase { assertEquals(null, url.getRef()); } + // This behavior of URLs with invalid user info changed due to bug http://b/33351987 after + // Android security level 1 April 2017. public void testAtSignInUserInfo() throws Exception { - try { - new URL("http://user@userhost.com:password@host"); - fail(); - } catch (MalformedURLException expected) { - } + URL url = new URL("http://user@userhost.com:password@host"); + assertNull(url.getUserInfo()); + assertTrue(url.getHost().isEmpty()); } public void testUserNoPassword() throws Exception { @@ -785,5 +785,6 @@ public final class URLTest extends TestCase { final String host = "http://multiple@users@url.com"; URL url = new URL(host); assertNull(url.getUserInfo()); + assertTrue(url.getHost().isEmpty()); } } |