<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1028,7 +1028,7 @@ public abstract class Uri implements Parcelable, Comparable&lt;Uri&gt; {
         }
 
         private String parseHost() {
-            String authority = getAuthority();
+            String authority = getEncodedAuthority();
             if (authority == null) {
                 return null;
             }
@@ -1037,9 +1037,11 @@ public abstract class Uri implements Parcelable, Comparable&lt;Uri&gt; {
             int userInfoSeparator = authority.indexOf('@');
             int portSeparator = authority.indexOf(':', userInfoSeparator);
 
-            return portSeparator == NOT_FOUND
+            String encodedHost = portSeparator == NOT_FOUND
                     ? authority.substring(userInfoSeparator + 1)
                     : authority.substring(userInfoSeparator + 1, portSeparator);
+
+            return decode(encodedHost);
         }
 
         private volatile int port = NOT_CALCULATED;
@@ -1051,7 +1053,7 @@ public abstract class Uri implements Parcelable, Comparable&lt;Uri&gt; {
         }
 
         private int parsePort() {
-            String authority = getAuthority();
+            String authority = getEncodedAuthority();
             if (authority == null) {
                 return -1;
             }
@@ -1065,7 +1067,7 @@ public abstract class Uri implements Parcelable, Comparable&lt;Uri&gt; {
                 return -1;
             }
 
-            String portString = authority.substring(portSeparator + 1);
+            String portString = decode(authority.substring(portSeparator + 1));
             try {
                 return Integer.parseInt(portString);
             } catch (NumberFormatException e) {</diff>
      <filename>core/java/android/net/Uri.java</filename>
    </modified>
    <modified>
      <diff>@@ -171,6 +171,11 @@ public class UriTest extends TestCase {
         assertEquals(&quot;bob lee&quot;, uri.getUserInfo());
         assertEquals(&quot;bob%20lee&quot;, uri.getEncodedUserInfo());
 
+        uri = Uri.parse(&quot;http://bob%40lee%3ajr@local%68ost:4%32&quot;);
+        assertEquals(&quot;bob@lee:jr&quot;, uri.getUserInfo());
+        assertEquals(&quot;localhost&quot;, uri.getHost());
+        assertEquals(42, uri.getPort());
+
         uri = Uri.parse(&quot;http://localhost&quot;);
         assertEquals(&quot;localhost&quot;, uri.getHost());
         assertEquals(-1, uri.getPort());</diff>
      <filename>tests/AndroidTests/src/com/android/unit_tests/UriTest.java</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>f9d9cf1ec146d8edbb2094416a823cd7b43098d0</id>
    </parent>
  </parents>
  <author>
    <name>Kenny Root</name>
    <email>kenny@the-b.org</email>
  </author>
  <url>http://github.com/android/platform_frameworks_base/commit/fc01794f33057862a361a0d0113630c58befc21b</url>
  <id>fc01794f33057862a361a0d0113630c58befc21b</id>
  <committed-date>2009-09-14T17:45:04-07:00</committed-date>
  <authored-date>2009-07-12T08:33:28-07:00</authored-date>
  <message>Make Uri.parseUserPart, parseHost, and parsePort symmetric

Currently parseUserPart uses the encoded authority to split the URI
into user and non-user parts, but the parseHost and parsePort uses
the decoded URI to split the URI into non-host, host, and port parts.
This gives unexpected results when %40 ('@') and %3a (':') is used
in a URI:

Uri test = Uri.parse(&quot;http://bob%40lee%3ajr@example.com:42/&quot;);
test.getUserInfo() =&gt; &quot;bob@lee:jr&quot;
test.getHost() =&gt; &quot;lee:jr@example.com&quot; (should be &quot;example.com&quot;)
test.getPort() =&gt; -1 (should be 42)</message>
  <tree>9f6096454c1ad47c4c3a9b5b2e2ef40517a02543</tree>
  <committer>
    <name>Jean-Baptiste Queru</name>
    <email>jbq@google.com</email>
  </committer>
</commit>
