Loading core/java/android/net/Uri.java +3 −3 Original line number Diff line number Diff line Loading @@ -1065,7 +1065,7 @@ public abstract class Uri implements Parcelable, Comparable<Uri> { return null; } int end = authority.indexOf('@'); int end = authority.lastIndexOf('@'); return end == NOT_FOUND ? null : authority.substring(0, end); } Loading @@ -1089,7 +1089,7 @@ public abstract class Uri implements Parcelable, Comparable<Uri> { } // Parse out user info and then port. int userInfoSeparator = authority.indexOf('@'); int userInfoSeparator = authority.lastIndexOf('@'); int portSeparator = authority.indexOf(':', userInfoSeparator); String encodedHost = portSeparator == NOT_FOUND Loading @@ -1115,7 +1115,7 @@ public abstract class Uri implements Parcelable, Comparable<Uri> { // Make sure we look for the port separtor *after* the user info // separator. We have URLs with a ':' in the user info. int userInfoSeparator = authority.indexOf('@'); int userInfoSeparator = authority.lastIndexOf('@'); int portSeparator = authority.indexOf(':', userInfoSeparator); if (portSeparator == NOT_FOUND) { Loading core/tests/coretests/src/android/net/UriTest.java +5 −0 Original line number Diff line number Diff line Loading @@ -187,6 +187,11 @@ public class UriTest extends TestCase { uri = Uri.parse("http://localhost"); assertEquals("localhost", uri.getHost()); assertEquals(-1, uri.getPort()); uri = Uri.parse("http://a:a@example.com:a@example2.com/path"); assertEquals("a:a@example.com:a@example2.com", uri.getAuthority()); assertEquals("example2.com", uri.getHost()); assertEquals(-1, uri.getPort()); } @SmallTest Loading Loading
core/java/android/net/Uri.java +3 −3 Original line number Diff line number Diff line Loading @@ -1065,7 +1065,7 @@ public abstract class Uri implements Parcelable, Comparable<Uri> { return null; } int end = authority.indexOf('@'); int end = authority.lastIndexOf('@'); return end == NOT_FOUND ? null : authority.substring(0, end); } Loading @@ -1089,7 +1089,7 @@ public abstract class Uri implements Parcelable, Comparable<Uri> { } // Parse out user info and then port. int userInfoSeparator = authority.indexOf('@'); int userInfoSeparator = authority.lastIndexOf('@'); int portSeparator = authority.indexOf(':', userInfoSeparator); String encodedHost = portSeparator == NOT_FOUND Loading @@ -1115,7 +1115,7 @@ public abstract class Uri implements Parcelable, Comparable<Uri> { // Make sure we look for the port separtor *after* the user info // separator. We have URLs with a ':' in the user info. int userInfoSeparator = authority.indexOf('@'); int userInfoSeparator = authority.lastIndexOf('@'); int portSeparator = authority.indexOf(':', userInfoSeparator); if (portSeparator == NOT_FOUND) { Loading
core/tests/coretests/src/android/net/UriTest.java +5 −0 Original line number Diff line number Diff line Loading @@ -187,6 +187,11 @@ public class UriTest extends TestCase { uri = Uri.parse("http://localhost"); assertEquals("localhost", uri.getHost()); assertEquals(-1, uri.getPort()); uri = Uri.parse("http://a:a@example.com:a@example2.com/path"); assertEquals("a:a@example.com:a@example2.com", uri.getAuthority()); assertEquals("example2.com", uri.getHost()); assertEquals(-1, uri.getPort()); } @SmallTest Loading