diff options
-rw-r--r-- | core/java/android/net/Uri.java | 2 | ||||
-rw-r--r-- | core/tests/coretests/src/android/net/UriTest.java | 8 |
2 files changed, 10 insertions, 0 deletions
diff --git a/core/java/android/net/Uri.java b/core/java/android/net/Uri.java index f2ea539..eca4569 100644 --- a/core/java/android/net/Uri.java +++ b/core/java/android/net/Uri.java @@ -1598,6 +1598,8 @@ public abstract class Uri implements Parcelable, Comparable<Uri> { end = query.length(); } return decode(query.substring(equalsIndex + 1, end)); + } else { + encodedKeySearchIndex = equalsIndex + 1; } } return null; diff --git a/core/tests/coretests/src/android/net/UriTest.java b/core/tests/coretests/src/android/net/UriTest.java index ad71fcb..095ee13 100644 --- a/core/tests/coretests/src/android/net/UriTest.java +++ b/core/tests/coretests/src/android/net/UriTest.java @@ -574,5 +574,13 @@ public class UriTest extends TestCase { .appendQueryParameter("key", "y z") .build(); assertEquals("y z", uri.getQueryParameter("key")); + + // key is a substring of parameters, but not present + uri = Uri.parse("http://test/").buildUpon() + .appendQueryParameter("akeyb", "a b") + .appendQueryParameter("keya", "c d") + .appendQueryParameter("bkey", "e f") + .build(); + assertNull(uri.getQueryParameter("key")); } } |